Skip to content

This repository hosts the source code of the backend of Momento an Event Management Platform.

Notifications You must be signed in to change notification settings

AltSumpreme/Momento-Backend

Repository files navigation

Event Management System

Overview

The Event Management System is a robust backend application built with Hono, Prisma, and PostgreSQL. It provides comprehensive functionalities for user authentication, event management, and booking systems, while enforcing a structured repository pattern and pre-commit hooks with Husky.

Features

User Authentication (Prisma & PostgreSQL)
Role-Based Access Control (USER, ADMIN, ORGANIZER)
Event Creation & Management
Event Booking System
Automated Code Quality Checks (Husky)


Tech Stack

  • Framework: Hono (Fast web framework for Edge & Serverless)
  • Database: PostgreSQL
  • ORM: Prisma
  • Linting & Formatting: ESLint, Prettier
  • Pre-commit Hooks: Husky

Installation

Prerequisites

Ensure you have the following installed:

Setup

1️⃣ Clone the repository

git clone https://github.com/yourusername/event-management.git
cd event-management

2️⃣ Install dependencies

npm install

3️⃣ Set up environment variables

cp .env.example .env

Edit .env and update the database URL:

DATABASE_URL="postgresql://user:password@localhost:5432/eventdb"

4️⃣ Run database migrations

npx prisma migrate dev --name init

5️⃣ Generate Prisma Client

npx prisma generate

6️⃣ Start the development server

npm run dev

Project Structure

📂 event-management/
├── prisma/          # Prisma schema & migrations
├── src/
│   ├── lib/         # Business logic for handling requests
│   ├── routes/      # API route definitions
│   ├── schema/      # Database interactions using Prisma
│   ├── util/        #Helper Functions
│   ├── index.ts/    # Hono server entry point
│   
├── .husky/          # Pre-commit hooks configuration
├── .env             # Environment variables
├── package.json     # Dependencies & scripts
└── README.md        # Documentation

API Endpoints

Authentication

  • POST /auth/register – Register a new user
  • POST /auth/login – Authenticate and receive a JWT

User

  • GET /User - Checks for the user and returns user specific details

Events

  • POST /events – Create a new event
  • GET /events – List all events
  • GET /events/:id – Get event details
  • DELETE /events/:id – Delete an event

Bookings

  • POST /bookings – Book an event
  • GET /bookings – List user bookings

Husky Pre-commit Hooks

This project uses Husky to enforce code quality before committing.

✅ Runs ESLint and Prettier checks.
❌ Prevents commits with linting errors.

Install Husky hooks:

npx husky install

Running Tests

npm test

Contributing

  1. Fork the repository.
  2. Create a feature branch:
    git checkout -b feature-name
  3. Commit your changes:
    git commit -m "Add new feature"
  4. Push to the branch:
    git push origin feature-name
  5. Open a Pull Request 🚀

License

This project is licensed under the MIT License.

📜 Feel free to modify and distribute.

About

This repository hosts the source code of the backend of Momento an Event Management Platform.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published