Event Management API
Objective:
Design and implement an Event Management REST API using Node.js, Express, and
PostgreSQL. The goal is to assess your backend development skills, including business logic
implementation, data structure handling, edge case management, and custom algorithmic
thinking.
🎯 Task Requirements
1. Event Management Features
Each event should include:
● Unique ID
● Title
● Date & Time (ISO format)
● Location
● Capacity (max 1000)
● Registrations (users who registered)
2. User Entity (PostgreSQL)
Use a PostgreSQL database to manage users, with the following:
● Unique ID
● Name
● Email
Create a proper relationship between users and events (many-to-many).
🧩 Required Endpoints
a. Create Event
● Validate capacity (positive, ≤1000)
● Respond with Event ID on success
b. Get Event Details
● Return all event data + registered users
c. Register for Event
● Register a user for an event
● Constraints:
○ No duplicate registrations
○ Cannot register if event is full
○ Cannot register for past events
d. Cancel Registration
● Cancel a user’s registration
● Return error if user wasn't registered
e. List Upcoming Events
● Return future events only
● Custom sorting:
○ First by date (ascending)
○ Then by location (alphabetically)
f. Event Stats
● Return:
○ Total registrations
○ Remaining capacity
○ Percentage of capacity used
📏 Business Logic Rules
● Enforce registration limits per event
● Prevent double registration
● Disallow registration for past events
● Return appropriate HTTP status codes and messages for all failures
● Validate all input data properly
🧠 Additional Requirements
● Use efficient data structures and algorithms
● Handle concurrent registration/cancellation scenarios
● Use custom comparator for sorting upcoming events
● Implement meaningful error messages and responses
✅ What You Need to Submit
● A public GitHub repository with:
○ Clean folder structure
○ Clear commit history
○ Well-documented code
○ README.md with:
■ Setup instructions
■ API description
■ Example requests/responses
⏰ Deadline
You have 24 hours from receiving this task to complete and submit it.