Skip to content
This repository was archived by the owner on Jul 28, 2025. It is now read-only.

Repository files navigation

noteId 8bcefa10c1ba11efb719c91af194d977
tags

GraphQL API with Fine-Grained Access Control


Description

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.


Table of Contents


Features

  • 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.

Getting Started

Open Using Daytona

  1. Install Daytona: Follow the Daytona installation guide.

  2. Create the Workspace:

    daytona create https://github.com/daytonaio/sample-nodejs-graphql-api

Add Forwarded Port

In your Text Editor/IDE, add 4000 as the forwarded port.

Start the Application

Navigate to the project root and run the following commands:

daytona use development

Start the server:

node src/server.js

Technologies

This 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.

Demo

Here’s a video walkthrough of the application:

Watch the video

Project Structure

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

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Sample Node.js GraphQL API

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages