The blog application consists of two apps, API express JS and Frontend Next JS to utilize the static generation renderer from Next JS.
All of the files needed are built on build time in comparison to server side which happens on run time for the features required.
SSG: Automatically generated as static HTML + JSON (uses getStaticProps)
This means more performance on not need server side to render page, caching and SEO and to capitalize of Next Js framework of pre-fetching files and content.
The draw backs are that there is a build dependency on the application where the front end service cannot deploy on certain pages unless it can request data from the API to generate the HTML + JSON files.
There is probably a solution of dependency build management when deploying through nx
-
NX Workspace for Mono Repo Management
- Generate and build skeletons of applications and frameworks required e.g NextJS, express
- Build and deploy commands
- Configuration setup for apps
- Building shared libraries which can be used for both applications
- Linting & Tests will be automatically run as part of the build process but can also be run independently.
Mockaroo - Mock generator and schema creation
Jest - Unit tests Jest - Integration tests
-
React - UI components
-
NextJS - For static server side generation framework for SSR and static generation
-
Styled-components - creating components with styles
-
All of the React components are camel case, this is something developers can agree on the conventions etc..
-
TODO: Improved some types
Jest - Unit tests , helpers etc..
React Testing Library - Testings pages and components
Cypress - Testing pages and flows of application
Docker - docker containers
npm install
npm run start api-service
npm run start blog
Note: Running integration tests for api service would need the service to be running
npm run test api-service
npm run test blog
Note: running this locally you need api-service to be running as static files are built on build time.
npm run e2e
npm run test api-service
npm run test blog
Note: Running integration tests for api service would need the service to be running
npm run lint api-service
npm run lint blog
Building containers will also leverage of making sure tests and linting issues are passed before deployment.
- Docker
- Node
- Npm
npm install
npm run start api-service
npm run deploy-docker-images
Deploy / Run:
Note: Please make sure you have existing services closed or no ports being on used on the same port
All Applications
docker-compose up
Or individually
docker-compose up api
docker-compose up blog
Open your browser and type
http://localhost:3000