Next.js/Node project using Typescript with MySQL via Prisma
This project can be deployed using Docker. Follow these steps to get started:
- Docker
- Docker Compose
- External MySQL database
This application is configured to use an external MySQL database for data persistence. This ensures your data remains intact even when Docker containers are removed or rebuilt.
- Set up your MySQL database server (either on a separate server, cloud service, or locally).
- Create a database for the application (e.g.,
feature-request-system). - Make sure your database is accessible from the Docker container.
- Copy
.env.docker.exampleto.env.dockerand update with your actual credentials.
Example connection string format:
DATABASE_URL="mysql://username:password@host.docker.internal:3306/feature-request-system"
-
Clone the repository:
git clone <repository-url> cd feature-request-system
-
Create or update your
.env.dockerfile with your environment variables:cp .env.docker.example .env.docker # Then edit .env.docker with your actual values -
Build and start the Docker container:
docker-compose up -d
-
Run database migrations (first-time setup):
docker-compose exec app npx prisma migrate deploy -
The application should now be running at http://localhost:3000.
docker-compose downYour .env.docker file should contain these variables:
DATABASE_URL- Connection string to your external MySQL database (using host.docker.internal)NEXTAUTH_SECRET- Secret for NextAuthNEXTAUTH_URL- URL for NextAuthGOOGLE_CLIENT_ID- Google OAuth client IDGOOGLE_CLIENT_SECRET- Google OAuth client secret
For security reasons, all .env* files are ignored in git (via .gitignore). When cloning this repository:
- Copy
.env.docker.exampleto.env.docker - Update with your actual credentials
- NEVER commit your actual
.envfiles with real credentials
This project uses GitHub Actions for continuous integration and deployment to AWS ECS.
The CI/CD pipeline automatically:
- Builds the Docker image
- Pushes it to Amazon ECR (Elastic Container Registry)
- Updates the ECS task definition
- Deploys the application to Amazon ECS (Elastic Container Service)
The workflow is configured to trigger on:
- Pushes to the
mainbranch - Manual triggers through the GitHub Actions interface
-
Ensure you have the required GitHub secrets configured:
AWS_ACCESS_KEY_IDAWS_SECRET_ACCESS_KEYNEXTAUTH_SECRET- Important: This must be the exact same secret used during local development to prevent JWT decryption errors
-
These credentials should belong to an IAM user with appropriate permissions for ECR and ECS operations.
For more detailed information about the CI/CD setup, see .github/workflows/README.md.