Skip to content

This repository provides a comprehensive template for setting up an Apollo GraphQL server with Firebase Authentication and PostgreSQL database integration. With this setup, you can quickly build powerful GraphQL APIs that authenticate users with Firebase and store data in a PostgreSQL database.

License

Notifications You must be signed in to change notification settings

Vaibhav-Solanki/apollo-graphql-boilerplate

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Apollo GraphQL Server Template with Firebase Auth and Postgres database

This repository provides a template for setting up an Apollo GraphQL server with Firebase Authentication. With this setup, you can quickly build powerful GraphQL APIs that leverage Firebase for user authentication.

Features

  • Apollo Server: Easily create a GraphQL server using Apollo Server.
  • Firebase Authentication: Secure your GraphQL API with Firebase Authentication, supporting various authentication methods such as email/password, Google Sign-In, Facebook Login, etc.
  • GraphQL Schema: Define your GraphQL schema using GraphQL SDL (Schema Definition Language).
  • Resolvers: Implement resolvers to handle GraphQL queries, mutations, and subscriptions.
  • Middleware: Add custom middleware to authenticate users and perform authorization checks.
  • Error Handling: Handle errors gracefully and provide meaningful error messages to clients.
  • Example Queries and Mutations: Include example GraphQL queries and mutations to help you get started quickly.

Setup

  1. Clone the Repository: Clone this repository to your local machine.

    git clone https://github.com/Vaibhav-Solanki/apollo-graphql-boilerplate.git
  2. Install Dependencies: Navigate to the project directory and install the required dependencies.

    cd apollo-graphql-boilerplate
    npm install
  3. Set Up Firebase Project: Create a Firebase project in the Firebase console (if you haven't already) and set up Firebase Authentication. Obtain your Firebase configuration details.

  4. Configure Environment Variables: Create a .env file in the root of the project and add your Firebase configuration.

    POSTGRES_URL="POSTGRES_URL"
    GOOGLE_APPLICATION_CREDENTIALS=".location to service account"
    
  5. Start the Server: Once everything is set up, start the GraphQL server.

    npm start
  6. Explore GraphQL Playground: Open your browser and navigate to http://localhost:4000/ to access the GraphQL Playground. You can start sending queries and mutations to interact with your GraphQL API.

Usage

  • Authentication: Use Firebase Authentication methods to sign up, sign in, and manage users.
  • GraphQL Operations: Define your GraphQL schema in the ./src/graphql/schema.js file and implement resolvers in the ./src/graphql directory.
  • Middleware: Customize middleware functions to authenticate users and perform authorization checks.
  • Error Handling: Handle errors gracefully in your resolvers and middleware functions.
  • Extend: Extend the functionality of the server by adding more resolvers, middleware, or integrating with other Firebase services.

Contributing

Contributions are welcome! Feel free to open issues or pull requests if you encounter any bugs or have suggestions for improvements.

License

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


Note: This template serves as a starting point for building GraphQL servers with Firebase Authentication. Make sure to review and customize the code according to your specific requirements and security considerations.

About

This repository provides a comprehensive template for setting up an Apollo GraphQL server with Firebase Authentication and PostgreSQL database integration. With this setup, you can quickly build powerful GraphQL APIs that authenticate users with Firebase and store data in a PostgreSQL database.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published