A feature-rich GraphQL starter template built with TypeScript, Yarn, Sequelize (TypeScript version), MySQL, Redis, and Docker. Designed for ease of use, debugging, and compatibility with Apollo Subscriptions.
- TypeScript: Strongly-typed language for enhanced development.
- Yarn: Fast, reliable package manager for dependency management.
- Sequelize (TypeScript): Powerful and flexible ORM for interacting with MySQL databases.
- MySQL Database: Robust relational database for data storage.
- Redis: Utilized for pubsub and caching functionalities.
- Docker: Containerization for easy deployment and scaling.
- Debugger Friendly: Ready for debugging with the
yarn devcommand. - Apollo Subscriptions: Seamless integration for real-time updates.
- Project Structure:
clients: Definition and instanciation of clients (Sequelize, Redis and RedisPubSub).constants: Centralized storage for project constants.gql: Definitions for GraphQL queries, mutations, types, and TypeScript resolvers.models: Sequelize models for database interaction.
- Clone the repository:
git clone https://github.com/Zuldruck/apollo-typescript-starter.git - Install dependencies:
yarn install - Copy the
.env.exampleto.envand configure the database settings. - Start the development server:
yarn dev
- Ensure Docker is installed on your machine.
- Run
docker-compose upto start the server, database, and Redis.
- Database configuration is defined in the
.envfile. Copy.env.exampleand update the values accordingly.
- The
scriptsfolder contains project-specific scripts, including thesync-databasescript for managing the database according to Sequelize models. - To run the
sync-databasescript, use the following command:This script will create or update the database based on the Sequelize models defined in theyarn script sync-database
modelsfolder. Feel free to adjust the wording or details based on the specific functionality of your "sync-database" script or any other scripts you may have in the "scripts" folder.
- Use
yarn devfor debugging with the debugger.
- Context creation file is located at
src/context.tsfor queries/mutations and another for subscriptions.
- Ready-to-use Apollo Subscriptions for real-time updates.
Contributions are welcome! Feel free to open issues or submit pull requests.