Coder Social home page Coder Social logo

airtribe's Introduction

Airtribe

Airtribe is a platform designed to facilitate online courses with multiple instructors and learners.

Problem Statement

Design a database and APIs for application-based courses on Airtribe.

Database Design

Entities

  1. Instructor

    • Represents an instructor on Airtribe.
    • Attributes: id, name, email, courses, leads, comments.
  2. Course

    • Represents a course offered by an instructor.
    • Attributes: id, name, max_seats, start_date, instructor_id, leads.
  3. Lead

    • Represents a learner's application for a course.
    • Attributes: id, name, email, phone_number, linkedin_profile, status, course_id.
  4. Comment

    • Represents a comment added by an instructor for a lead.
    • Attributes: id, text, lead_id, instructor_id.

Database Relations

  • An instructor can have multiple courses.
  • Multiple learners can apply for a course (leads).
  • Each lead can have multiple comments from instructors.

Features

  • Create Course API: Allows instructors to create a new course.
  • Update Course Details API: Enables updating course details such as name, max seats, start date, etc.
  • Course Registration API: Allows learners to apply for a course by providing their details.
  • Lead Update API: Enables instructors to change the status of a lead (accept/reject/waitlist).
  • Lead Search API: Allows instructors to search for leads by name or email.
  • Add Comment API: Enables instructors to add comments for leads.

Tech Stack

  • Backend Server: Node.js with Express framework
  • Database: SQL Database (e.g., PostgreSQL) with TypeORM for ORM
  • Container: Dockerized Database

Requirements

  • Node JS
  • Docker

Installation

  1. Clone the repository:
git clone https://github.com/rajprem4214/AirTribe.git
cd AirTribe
  1. Install Dependencies
npm install
  1. Run Docker Container
docker compose up -d
  1. Run the server
npm start

or

nodemon src/index.ts

Server URL - [http://127.0.0.1:3000]

API Reference

Create Course

  • Creates a new course.

  • URL: /api/v1/courses/new

  • Method: POST

  • Request Body:

    {
      "name": "Course Name",
      "max_seats": 20,
      "start_date": "2024-03-15",
      "instructor_id": 1
    }

Update Courses

  • Updates a course.

  • URL: /api/v1/courses/:id

  • Method: PATCH

  • Request Body:

    {
    "name": "New Course Name",
    "max_seats": 25,
    "start_date": "2024-04-01"
    }

Course Registration

  • Creates a lead.

  • URL: /api/v1/lead/new

  • Method: POST

  • Request Body:

    {
    "courseId": 2,
    "name": "Learner Name",
    "email": "[email protected]",
    "phone_number": "1234567890",
    "linkedin_profile": "https://www.linkedin.com/in/learner"
    }

Lead Update

  • Updates a lead.

  • URL: /api/v1/lead/:id

  • Method: PATCH

  • Request Body:

    {
    "status": "Accepted"
    }

Lead Search

  • Searches for leads by name or email.

  • URL: /api/v1/lead/search?query=<name_or_email>

  • Method: GET

  • Request Body:

Add Comment

  • Adds a comment for a lead.

  • URL: /api/v1/comment/add

  • Method: POST

  • Request Body:

    {
    "leadId": "lead_id",
    "text": "Comment text",
    "instructorId": 1
    }

Optimizations

  • Implemented Caching for GET api with help of TypeORM to reduce data fetch time. (Effect - 60ms down to 7ms)

airtribe's People

Contributors

rajprem4214 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.