This is a backend framework and provides robust APIs to access extensive guides, bytes, and more from your database.
Before you begin, ensure you have met the following requirements:
- You have installed Node.js (version 18 or above)
- You have a Yarn package manager installed
- Docker and Docker Compose are installed on your machine
- You have installed Postgres and done with its setup
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes:
-
Clone the repository
Clone the repository to your local machine.
git clone https://github.com/RobinNagpal/dodao-api.git
-
Install dependencies
Navigate to the project directory and run the following command to install the necessary packages:
yarn install
-
Setup environment variables
- Rename the
.env.example
file to.env
and modify the keys as needed. - Make sure to update
DATABASE_URL
according to your own postgres username and password:
postgresql://<username>:<password>@localhost:5432/dodao_api_localhost_db?sslmode=verify-full
-
Assign a file path from your local machine to an empty folder in
MAIN_GIT_FOLDER_PATH
key.For example:
if you have cloned the repo in directory e.g.
D:\DoDao
, create an empty folderdodao-api-git
in the same directory and update the keyMAIN_GIT_FOLDER_PATH
toD:\DoDao\dodao-api-git
. -
Make sure
NEXTAUTH_SECRET
&DODAO_AUTH_SECRET
have the same keys as present in.env
ofdodao-ui
project -
Create a new key
NODE_ENV
and set its value tolocal
like soNODE_ENV=local
-
Create a new key
DODAO_SUPERADMINS
and set its value to your own MetaMask account address and comma separated email address.For example:
DODAO_SUPERADMINS = 0x0000000000000000000000000000000000000000, [email protected]
-
Assign random string values to the remaining empty keys.
- Rename the
-
Run Docker
Make sure Docker Desktop is running, then start your services using Docker Compose:
docker-compose up
-
Generate Prisma Client
Run the following command to generate your Prisma Client:
npx prisma generate
-
Generate Prisma Migrations
Run the following command to generate your Prisma Migrations:
npx prisma migrate dev
-
Insert into Postgres
Copy the insert commands from
init.sql
file and run them into your Postgres, to insert data. -
Start the development server
Now you're ready to start the development server:
yarn dev
You should now be able to access the GraphQL server at http://localhost:8000/graphql.
See CodingWorkflow.md to learn about how to start contributing to the project.