| noteId | 8bcefa10c1ba11efb719c91af194d977 |
|---|---|
| tags |
This project demonstrates how to create a GraphQL API with fine-grained access control on your database using Node.js, Express.js, Apollo Server, and MongoDB. The project integrates Daytona for streamlined development environment management, making it easier to handle environment-specific configurations and secrets.
- GraphQL API: A robust API with query, mutation, and subscription support.
- Access Control: Fine-grained access controls implemented at the resolver level to ensure secure data operations.
- Environment Management: Powered by Daytona to handle development, staging, and production configurations seamlessly.
- MongoDB Integration: Utilized as the database to store and retrieve data efficiently.
-
Install Daytona: Follow the Daytona installation guide.
-
Create the Workspace:
daytona create https://github.com/daytonaio/sample-nodejs-graphql-api
In your Text Editor/IDE, add 4000 as the forwarded port.
Navigate to the project root and run the following commands:
daytona use developmentStart the server:
node src/server.jsThis project is built using the following technologies:
- Node.js: JavaScript runtime for the server-side application.
- Apollo Server: GraphQL server for creating schemas and resolvers.
- Express.js: Lightweight backend framework for integrating middleware and routing.
- MongoDB: NoSQL database for data persistence.
- Daytona: Development environment manager for seamless configuration and secrets management.
- Dotenv: Environment variable management for fallback configurations.
Here’s a video walkthrough of the application:
graphql-api-project/
├── src/
│ ├── schema/
│ │ ├── typeDefs.js # GraphQL schema definitions
│ │ ├── resolvers.js # Resolver logic
│ ├── utils/
│ │ ├── auth.js # Middleware for authentication
│ ├── server.js # Entry point for the server
│ ├── daytona.json # Daytona configuration
├── package.json # Project dependencies
├── .env # Environment variables (Daytona-enabled)
├── README.md # Documentation
This project is licensed under the MIT License - see the LICENSE file for details.