a small internship challenge for building a simple api return school list and create schools
- Node.js & Express.js – Server & routing
- TypeScript – Type-safe development
- Prisma ORM – Type-safe database access
- PostgreSQL – Relational database
- Zod – Runtime schema validation
- Nodemon – Development server auto-restart
- ESLint + Prettier – Code linting & formatting
- Postman – API testing & documentation
.
├── src/
│ ├── config/ # App & database configuration
│ ├── controller/ # Route controllers
│ ├── middleware/ # Auth, error handling, validation
│ ├── routes/ # API routes
│ ├── utils/ # Helper functions
│ ├── zod/ # Zod validation schemas
│ ├── types/ # Type definitions
│ ├── tests/ # integration and uni testing
│ ├── app.ts # Express app initialization
│ └── server.ts # Server entry point
├── prisma/ # Prisma schema & migrations
├── uploads/ # Uploaded files (images) localTesting
├── .env
├── package.json
└── README.md- Node.js v22+
- PostgreSQL v16+
- Clone the repository:
git clone https://github.com/rajwindersxxx/api-server-school
cd api-server-school- Install dependencies:
npm install- Create a
.envfile:
DATABASE_URL=<postgres-url>
- Initialize Prisma:
npx prisma generate # Generate Prisma client
npx prisma db push # Push schema to DB
npx prisma db seed # Seed sample data
npx prisma migrate # generate after making changes in db
npx prisma migrate deploy #push schema in production safely
Note: seed Data totalAmount and items price not accurate !
- Start development server:
npm run devYou should see:
Server is running on http://localhost:4000>✅ Database connection successful
- API → http://localhost:4000
All API endpoints are documented with Postman: View API Docs in Postman
Key endpoints include:
| Feature | Endpoint | Method |
|---|---|---|
| Add school | /api/v1/school |
POST |
| get school list | /api/v1/auth/login |
GET |
- Type-safe backend & database using Prisma + TypeScript
- Runtime validation with Zod
- Create and read operations for School
- Postman documentation for all endpoints
- build basic crud with firebase
- setting up firebase need firebase.json as key