Assign Module CoderByte API by Job Name
This project is an Express.js API built with TypeScript, using Prisma as the ORM, Zod for validation, and JWT for authentication.
Before you begin, ensure you have the following installed on your system:
- Node.js (v14 or later)
- npm (usually comes with Node.js)
- MySQL (or your preferred database supported by Prisma)
-
Clone the repository:
git clone https://github.com/hafizcode02/idstar-api-amcb.git cd idstar-api-amcb -
Install dependencies:
npm install -
Set up your environment variables:
- Copy the
.env-examplefile to.env - Update the
.envfile with your database connection string and JWT secret:DATABASE_URL="postgresql://username:password@localhost:5432/your_database_name" JWT_SECRET="your-secret-key" JWT_EXPIRES_IN="1d" PORT=3003
- Copy the
-
Set up the database:
- Run Prisma migrations to create your database schema:
npx prisma migrate dev - (Optional) Seed the database with initial data:
npx prisma db seed
- Run Prisma migrations to create your database schema:
-
For development:
npm run dev -
For production:
npm run build npm start
The server will start on http://localhost:3003 (or the port specified in your environment variables).