This guide covers the setup process for both the backend and mobile parts of the project.
.env.example
file in the backend
directory to a new file named .env
..env
file. like your database URL, JWT secret, etc.backend
directory.npm install
npx prisma db push
npx prisma generate
npm run dev
http://localhost:8000
.Open the mobile/lib/axios.config.js
file.
Change the IP_ADDRESS
variable to your local IP address. This is necessary for the mobile app to communicate with the backend.
There are no specific environment variables to set up for the mobile part, but ensure that the backend's IP address
is correctly set as mentioned above.
mobile
directory.npm install
npx expo start
prisma is a modern database toolkit that makes it easy to work with databases in your application. It provides an ORM (Object-Relational Mapping) layer that allows you to interact with your database using a type-safe API.
The Prisma schema is a declarative file that defines your database schema. It describes the data model, relationships, and constraints of your database.
The schema is defined in the schema.prisma
file in the backend
directory. It uses Prisma's own schema language to define the data model.
To update the schema in Prisma, follow these steps:
schema.prisma
file in the backend
directory.To format the schema in Prisma, you can use the prisma format
command. Run the following command in the terminal:
npx prisma format
This command will automatically format the schema file according to Prisma's formatting rules.
The Prisma client is an auto-generated library that provides a type-safe and convenient way to interact with your database. It allows you to perform CRUD operations and execute complex queries.
To generate the Prisma client, run the following command in the terminal:
npx prisma generate
This command will generate the Prisma client based on your schema definition.
To sync your Prisma schema with the database, use the prisma db push
command. This command will apply any pending migrations and update the database schema accordingly.
Run the following command in the terminal:
npx prisma db push