A template project to create NextJS skeleton with typescript
This is a Next.js project bootstrapped with create-next-app
.
npm run build
npm test
npm run dev
The following commands build and run a production equivalent container
- Build the project
npm ci
npm run build
- Build the docker container
docker build . -t nextjs-template
- Run the docker container
docker run -d -p 3000:3000 -t nextjs-template:latest
To set up the project by forking this project, then the following instructions need to be carried out. Please read these instructions carefully to ensure no steps are missed out.
For code quality checks we use SonarCloud and the project must be setup in SonarCloud.
- Login to SonarCloud
- Click the + and then Analyze new project
- Select the GitHub project you have created with this template
- Click Setup
- Disable Automatic Analysis
- Update sonar-project.properties with the correct information for the project key and git repository
- Modify the basePath configuration to match the application. See Base Path documentation for more.
- Update the links to the badges
- Update all references for nextjs-template After cloning this template please do the following to ensure your project builds and deploys correctly
- name
- version
- repository
- description
- license
We follow semantic versioning where possible. Generally we do not update versions unless there has been a breaking change in our service contracts.
The versions can be increased in the GitHub Action file when required.
This project uses Terraform to deploy the service to the PreviewMe ECS cluster.
The following changes need to be made in the Terraform configuration.
- In
deployment/ecr/backend.tf
replace the workspace name to match the project name E.g: foo-ecr
The following steps need to be carried out for the Terraform configuration for the docker container to be deployed correctly.
- In
deployment/service/backend.tf
replace the workspace tags with the name of the project E.g: foo. - In
deployment/service/main.tf
modify the locals.workspace variable to match your tag name in step 1. - In
deployment/service/variables.tf
modify the default values to match the application. - In
deployment/service/networking.tf
modify any configuration to match the application. - Change to
deployment/service
folder and runterraform init
to initialise the project.- If prompted to create a workspace create the value
${application-name}-production
. E.g: foo-production.
- If prompted to create a workspace create the value
- Create a development workspace by running
terraform workspace new ${application-name}-development
E.g: foo-development. - Update condition on the deploy-production job in build.yml to match the deploy-development when the service is production ready.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!