Application based on Nest.js framework with GraphQL configuration. In This application you can review how to use graphql on both client and backend sides.
In this application you can find examples to review:
- How to create base Nest.js server side application.
- How to setup GraphQL configuration on backend side using Apollo Graphql.
- How to connect PostgreSQL database via TypeORM and connect it to graphql resolvers.
- How to create or generate migrations for PostgreSQL tables using TypeORM.
- How to generate and use GraphQL queries, mutations and subscriptions.
- How to use PassportJS different strategies alongside with Apollo GraphQL.
- How to use GraphQL subscriptions with the PubSub.
- How to cache requests to the database using Redis.
- How to test your graphql resolvers and services using Jest.
- How to serve static files with Nest.js.
- E2E tests configuration.
- How to create base React application.
- How to connect apollo-client to React application.
- How to use graphql mutations, subscriptions and queries on client side.
- How to build your frontend application and serve it with Nest.js.
- Linter rules, prettier, webpack config, babel config, jest config setup.
- How to use Docker to deploy and run application.
- How to use .env files.
- How to create base CI\CD configuration for TravisCI.
- How to run tests with TravisCI.
- How to deploy application on AWS cloud services using TravisCI.
- How to use RDS, ECR, ECS, EC2, Elasitcashe from AWS.
- TypeScript
- Nest.js
- GraphQL
- TypeORM
- Passport.js
- PostgreSQL (RDS)
- Redis caching (Elastic cache)
- Docker (ECR)
- CI (Travis CI)
- React.js (latest, without state management library)
- S3 for satatic and images upload
- AWS (S3, EC2, RDS, AMI)
$ npm install
# development
$ npm run start
# watch mode
$ npm run start:dev
# production mode
$ npm run start:prod
# unit tests
$ npm run test
# e2e tests
$ npm run test:e2e
# test coverage
$ npm run test:cov
To run application with TLS certificate perform next steps:
- Generate TLS certificate using next command:
openssl req -newkey rsa:2048 -new -nodes -x509 -days 3650 -keyout key.pem -out cert.pem
- Move generated certificates to ssl folder.
- Run application.
docker build . -t ts-nest
docker run -i -t -p 3000:3000 ts-nest
Or if you can run bash then just,
sh run.sh
- Create TravisCI account and connect it to your GitHub account.
- In repositories list choose this repository and create build configuration.
- Travis will run tests and deploy on every push to the repository master branch.
- Create AWS Account
- Add PostgreSQL DB in RDS
- Add Redis in ElastiCache
- Add repository in ECR
- Add Task definition and Cluster in ECS
- Add these invironment varialbles to Travis CI variables:
AWS_ACCESS_KEY_ID AWS_DEFAULT_REGION AWS_SECRET_ACCESS_KEY CLUSTER_NAME ## ECS IMAGE_REPO_URL ## ECR SERVICE_NAME ## ECS
- Push to GitHub and run Travis CI pipeline