This is a RESTful API for participant management in in-person events. It has well-defined resources to handle operations such as creating, reading, updating, and deleting (CRUD) participants, as well as additional functionalities for managing the events themselves.
- GET /events: Returns the list of all events.
- GET /events/{id}: Returns details of a specific event.
- POST /events: Creates a new event.
- PUT /events/{id}: Updates the details of an existing event.
- DELETE /events/{id}: Deletes an event.
- GET /events/{event_id}/participants: Returns the list of participants for a specific event.
- GET /participants/{id}: Returns details of a specific participant.
- POST /events/{event_id}/participants: Adds a new participant to an event.
- PUT /participants/{id}: Updates the details of an existing participant.
- DELETE /participants/{id}: Removes a participant.
{
"id": "string",
"name": "string",
"description": "string",
"date": "string (ISO format)",
"location": "string"
}
{
"id": "string",
"name": "string",
"email": "string",
"phone": "string",
"event_id": "string (reference to the event)"
}
- Fastify: For routing and handling HTTP requests.
- Prisma ORM for modeling and interacting with the database (MongoDB, MySQL, PostgreSQL, etc.).
- Body-parser: For parsing JSON request bodies.
- jsonwebtoken: For authentication and authorization (if needed).
- bcrypt: For encrypting passwords (if user authentication is needed).
- Zod: For data validation.
- Helmet: For protection against various web vulnerabilities.
- Swagger: To document the routes.
- Receive HTTP requests through Fastify.
- Route to appropriate request handlers.
- Validate and process data using Zod and other tools as needed.
- Interact with the database using Prisma/SQLite.
- Return appropriate responses.
- Documentation using Swagger.
-- CreateTable
CREATE TABLE "events" (
"id" TEXT NOT NULL PRIMARY KEY,
"title" TEXT NOT NULL,
"details" TEXT,
"slug" TEXT NOT NULL,
"maximum_attendees" INTEGER
);
-- CreateTable
CREATE TABLE "participants" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"name" TEXT NOT NULL,
"email" TEXT NOT NULL,
"event_id" TEXT NOT NULL,
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
CONSTRAINT "attendees_event_id_fkey" FOREIGN KEY ("event_id") REFERENCES "events" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateTable
CREATE TABLE "check_ins" (
"id" INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
"created_at" DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
"participantId" INTEGER NOT NULL,
CONSTRAINT "check_ins_attendeeId_fkey" FOREIGN KEY ("participantId") REFERENCES "participants" ("id") ON DELETE RESTRICT ON UPDATE CASCADE
);
-- CreateIndex
CREATE UNIQUE INDEX "events_slug_key" ON "events"("slug");
-- CreateIndex
CREATE UNIQUE INDEX "attendees_event_id_email_key" ON "participants"("event_id", "email");
-- CreateIndex
CREATE UNIQUE INDEX "check_ins_attendeeId_key" ON "check_ins"("participantId");
Developed with 💓 by Renato Khael
Visit: renatokhael.dev