Skip to content

Repository files navigation

🛠 EventHub Backend

Welcome to EventHub’s backend repository! This project provides a RESTful API to support event booking, availability management, and service coordination. It’s designed as a foundation for the backend services of the EventHub platform, ready to integrate with a frontend application.


📋 Table of Contents

  1. Overview
  2. Features
  3. Tech Stack
  4. Installation
  5. Configuration
  6. API Endpoints
  7. Usage
  8. Frontend Integration
  9. Troubleshooting
  10. Contributing
  11. License

📝 Overview

The EventHub backend enables efficient event management, handling all data operations related to events, user accounts, bookings, and availability. Once integrated with a frontend, it will allow users to browse and book events in real-time.


🚀 Features

  • User Registration & Authentication: Register and authenticate users with JWT.
  • Event & Availability Management: CRUD operations for events and service schedules.
  • Booking API: Allows clients to book available slots.
  • Secure Endpoints: Authentication for sensitive routes.

🛠 Tech Stack

  • Node.js: JavaScript runtime
  • Express: Backend framework for creating RESTful APIs
  • MongoDB: NoSQL database for storing events, users, and bookings
  • JWT: Secure user authentication

💾 Installation

Prerequisites

Ensure you have:

Clone the Repository

git clone https://github.com/MariferVL/eventhub-backend.git
cd eventhub-backend

Install Dependencies

npm install

🔧 Configuration

Create a .env file in the root directory and set up the following:

PORT=5000
MONGODB_URI=your_mongodb_connection_string
JWT_SECRET=your_jwt_secret
  • PORT: Server port (default 5000)
  • MONGODB_URI: MongoDB connection string
  • JWT_SECRET: Secret for signing JWTs

📂 API Endpoints

Auth Routes

  • POST /api/auth/register: Register a new user
  • POST /api/auth/login: User login, returns JWT

User Routes

  • GET /api/users/:id: Fetch user details (protected)

Event Routes

  • GET /api/events: Get all events
  • POST /api/events: Create a new event (admin only)
  • PUT /api/events/:id: Update an event (admin only)
  • DELETE /api/events/:id: Delete an event (admin only)

Note: For complete endpoint details, refer to the API documentation file.


📲 Usage

Running the Development Server

Start the backend server:

npm start

Navigate to http://localhost:5000/api in your browser or testing tool (like Postman) to explore the API.


🌐 Frontend Integration

This backend is designed to be integrated with any frontend framework. Suggested steps for setting up:

  1. Configure CORS: Update CORS settings in app.js to accept requests from your frontend domain.
  2. Frontend Auth: Send JWT in headers for authenticated requests.
  3. API Consumption: Make API calls to http://localhost:5000/api (or deployed domain) to fetch, create, and update data.

🐛 Troubleshooting

  • Database Connection Issues: Ensure MongoDB is running and MONGODB_URI is correct.
  • JWT Issues: Verify JWT_SECRET in .env.
  • CORS Errors: Ensure your frontend domain is whitelisted in CORS settings.

🤝 Contributing

Contributions are welcome! Please follow the standard GitHub flow: fork, make changes, and submit a pull request.


📜 License

This project is licensed under the MIT License.

About

A full-stack Node.js application designed for event management, including user authentication, event creation, and real-time notifications using WebSocket. EventHub provides an organized and efficient system for managing users, events, and reservations.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages