A robust and scalable backend for managing events and clients, built with Node.js, Express, TypeScript, and TypeORM, powered by Neon Postgres.
This system allows organizations to manage their events and for clients to register and participate. It features secure authentication, event CRUD operations, and client profile management.
- Event Management: Create, list, view details, and delete events.
- Client Authentication: Secure sign-up and sign-in with JWT.
- Registration System: Clients can register for events and view their participation list.
- Client Management: List all clients and manage personal profiles.
- Swagger Documentation: Interactive API documentation available at
/api-docs. - Database Branching: Leveraging Neon Postgres for seamless development and production environments.
- Node.js
- Yarn or NPM
- Neon Postgres account
- Clone the repository:
git clone <repository-url>
- Install dependencies:
yarn install
- Set up environment variables (.env):
PORT=3000 NODE_ENV="development" DEV_DATABASE_URI=your_neon_dev_uri MAIN_DATABASE_URI=your_neon_main_uri COOKIE_SECRET=your_cookie_secret JWT_SECRET=your_jwt_secret
- Generate initial migrations:
yarn build npx typeorm-ts-node-commonjs migration:generate ./src/typeorm/migrations/InitialSchema -d ./src/typeorm/data-source.ts
- Run migrations:
yarn typeorm migration:run -d src/typeorm/data-source.ts
yarn dev # Development mode
yarn build && yarn start # Production modeThe API will be accessible at http://localhost:3000.
Swagger UI is available at http://localhost:3000/api-docs.
This project is configured for deployment as Vercel Serverless Functions.
The project includes a vercel.json file and an api/index.ts entry point that exports the Express app.
You must set the following environment variables in your Vercel Project Settings:
NODE_ENV:productionMAIN_DATABASE_URI: Your production PostgreSQL connection string.COOKIE_SECRET: A secure random string.JWT_SECRET: A secure random string.DB_PORT:5432(or your DB port).
- Via Vercel CLI: Run
vercelin the root directory. - Via GitHub: Connect your repository to Vercel. It will automatically detect the configuration and deploy.
POST /api/v1/auth/signup: Register a new client.POST /api/v1/auth/signin: Authenticate and get token.
GET /api/v1/events: List all events.GET /api/v1/events/:id: Get event details.POST /api/v1/events: Create a new event.DELETE /api/v1/events/:id: Delete an event.POST /api/v1/events/:id/register: Register current client for an event.
GET /api/v1/clients: List all clients.GET /api/v1/clients/me: Get current client profile.PUT /api/v1/clients/me: Update profile.
For more detailed technical tips and migration guides, see docs/README.md.
Souhail Tourjmen
MIT