This is the README file for the Social Media Backend project, which includes a Docker Compose configuration and a Node.js application. The project utilizes Docker to set up a PostgreSQL database and a Redis server for development purposes. Additionally, it is built with TypeScript and utilizes popular GraphQL and Prisma libraries to create a GraphQL API server.
Before getting started, ensure you have the following software installed on your system:
- Docker
- Node.js (version 16 or higher)
- npm (Node Package Manager)
- TypeScript
- Prisma
You can also run this project in a Gitpod workspace, which provides a development environment in the cloud. Click the link below to open this repository in a Gitpod workspace:
Clone this repository to your local machine:
git clone https://github.com/AbhishekCS3459/GraphQl_Nodejs_Backend
cd Social Media Backend
The project includes a docker-compose.yml
file that defines two services: PostgreSQL and Redis. To set up these services, run the following command in the project root directory:
docker-compose up -d
This command will create and start containers for PostgreSQL and Redis. You can access PostgreSQL on port 5432 and Redis on port 6379.
Next, you need to install the Node.js dependencies for the GraphQL server. Run the following command in the project root directory:
npm install
This project uses Prisma for database management. Before you can run the GraphQL server, you need to generate the Prisma client. Use the following command:
npx prisma generate
You can start the GraphQL server with the following command:
npm run dev
The server will be available at http://localhost:8000/graphql.
You can now use your GraphQL API to interact with the database. Open a GraphQL client, like Apollo Studio, and start sending queries and mutations.
- docker-compose.yml: Defines the Docker services for PostgreSQL and Redis.
- package.json: Node.js project configuration file with dependencies and scripts.
- src: Contains the source code for the GraphQL server.
- prisma: Contains Prisma configuration and database schema.
This project is licensed under the MIT License. You can find the full license details in the LICENSE file.
- This project is built with GraphQL, Prisma, and other open-source technologies.
- Special thanks to the Docker community for making containerization easy.
If you encounter any issues or have suggestions for improvements, please open an issue on this repository. Contributions and pull requests are welcome!
Enjoy using Social Media Backend for your GraphQL development and database management needs!
- The GraphQL server will be accessible at
http://localhost:4000
in your local environment. - The Prisma Client and database schema are set up for you to interact with the PostgreSQL database. You can modify the schema in the
prisma/schema.prisma
file. - Creating posts and other features will be soon included into this repo