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 dev
command. - 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.example
to.env
and configure the database settings. - Start the development server:
yarn dev
- Ensure Docker is installed on your machine.
- Run
docker-compose up
to start the server, database, and Redis.
- Database configuration is defined in the
.env
file. Copy.env.example
and update the values accordingly.
- The
scripts
folder contains project-specific scripts, including thesync-database
script for managing the database according to Sequelize models. - To run the
sync-database
script, use the following command:This script will create or update the database based on the Sequelize models defined in theyarn script sync-database
models
folder. 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 dev
for debugging with the debugger.
- Context creation file is located at
src/context.ts
for 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.