A NestJS-based GraphQL API for the Chizek application, providing forum and chat functionality.
- GraphQL API with Apollo Server
- MongoDB integration with Mongoose
- Authentication using JWT
- Forum functionality
- Real-time AI integrated chat (coming soon)
- Node.js (v18 or higher)
- MongoDB (v6.0 or higher)
- Yarn package manager
- TypeScript (^5.7.3)
- NestJS CLI (^11.0.0)
- NestJS Core (^11.0.6)
- GraphQL (^16.10.0)
- Apollo Server (^4.11.3)
- Mongoose (^8.9.4)
- MongoDB Driver (^6.12.0)
- Passport (^0.7.0)
- JWT (^11.0.0)
- bcrypt (^5.1.1)
- class-validator (^0.14.1)
- class-transformer (^0.5.1)
- nestjs-pino (^4.2.0)
- pino-http (^10.4.0)
Install these packages globally:
# Install NestJS CLI
yarn global add @nestjs/[email protected]
# Install TypeScript
yarn global add [email protected]
For the best development experience, ensure your IDE has the following:
- TypeScript support
- ESLint integration (^9.22.0)
- Prettier integration (^3.5.3)
- GraphQL extension
Recommended VS Code extensions:
- ESLint
- Prettier
- GraphQL
- Clone the repository:
git clone https://github.com/yourusername/chizek-api.git
cd chizek-api
- Install dependencies:
yarn install
- Create a
.env
file in the root directory with the following variables:
DB_NAME=your_db_name
MONGODB_URI=mongodb://your_db_url
JWT_SECRET=your_jwt_secret
JWT_EXPIRATION=your_duration
Start MongoDB locally:
mongod --dbpath=databases/mongo/data
# Development mode
yarn start:dev
# Production build
yarn build
yarn start:prod
# Debug mode
yarn start:debug
# Unit tests
yarn test
# E2E tests
yarn test:e2e
# Test coverage
yarn test:cov
- Jest configuration in
jest.config.ts
- E2E tests in
test
directory - Coverage reports in
coverage
directory
- Configuration file:
eslint.config.mjs
- TypeScript-specific rules enabled
- Prettier integration
- Configuration file:
.prettierrc
- Consistent code formatting across the project
The API uses standard HTTP status codes and GraphQL errors:
- 400: Bad Request
- 401: Unauthorized
- 403: Forbidden
- 404: Not Found
- 500: Internal Server Error
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
- Follow the established code style
- Write tests for new features
- Update documentation as needed
- Use meaningful commit messages
yarn build
yarn start:prod
- Node.js production environment
- MongoDB instance
- Environment variables properly configured
- Sufficient memory and CPU resources
Common issues and solutions:
-
MongoDB connection issues:
- Verify MongoDB is running
- Check connection string
- Ensure correct credentials
-
GraphQL endpoint issues:
- Check Apollo Server configuration
- Verify schema generation
- Check resolver implementations