GithubHelp home page GithubHelp logo

montsouz / javascript-fullstack Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 183 KB

Home Page: https://javascript-fullstack.vercel.app

Dockerfile 0.49% TypeScript 91.82% JavaScript 1.69% HTML 1.13% CSS 4.86%

javascript-fullstack's Introduction

JavaScript Fullstack

This repo implements a fullstack application that uses Node on the backend, and React on the frontend

Check out the deployed version here!

javascript-fullstack.vercel.app

Backend

It's a simple API that returns plans and saves purchased plans in the DB

Tech stack

  • Node
  • TypeScript
  • Sequelize
  • PostgreSQL
  • AWS (ECR, App Runner, RDS)
  • Docker
  • Jest + Supertest
  • Github Actions

Install deps

npm install

How to run

npm run dev:docker

Run tests

npm run test:docker

Frontend

Simple client written in react. Contains three pages Login, Plans, and a Dashboard where you can check the plans you've purchased.

Tech stack

  • React
  • TypeScript
  • Vite
  • Chakra UI
  • Vercel

Install deps

npm install

How to run

npm run dev

API Documentation

This document outlines the available REST API endpoints for our service, including methods for authentication, retrieving plans, and handling purchases.

Endpoints

POST /login

Authenticates a user and returns a token.

Request

  • Body
{
  "email": "[email protected]",
  "password": "yourpassword"
}

Response

  • Success (200 OK)
{
  "token": "jwt.token.here"
}
  • Error (401 Unauthorized)
{
  "message": "Invalid email or password"
}

GET /plans

Retrieves a list of available plans. Requires authentication.

Request

  • Headers

Authorization: Bearer <token>

Response

  • Success (200 OK)
[
  {
    "id": 1,
    "name": "Basic Plan",
    "steps": [
      {
        "name": "Step 1",
        "order": 1
      },
      {
        "name": "Step 2",
        "order": 2
      }
    ]
  }
]

POST /purchases

Creates a purchase for a plan. Requires authentication.

Request

  • Body
{
  "planId": 1
}
  • Headers

Authorization: Bearer <token>

Response

  • Success (200 OK)
{
  "id": 1,
  "name": "Basic Plan",
  "userId": 123,
  "steps": [
    {
      "name": "Step 1",
      "order": 1
    },
    {
      "name": "Step 2",
      "order": 2
    }
  ]
}
  • Error (404 Not Found)
{
  "message": "Plan not found"
}

or

{
  "message": "User not found"
}

GET /purchases

Retrieves a list of purchases made by the authenticated user.

Request

  • Headers

Authorization: Bearer <token>

Response

  • Success (200 OK)
[
  {
    "id": 1,
    "name": "Basic Plan",
    "userId": 123,
    "steps": [
      {
        "name": "Step 1",
        "order": 1
      },
      {
        "name": "Step 2",
        "order": 2
      }
    ]
  }
]

Authentication

All endpoints, except for /login, require a valid JWT token to be included in the Authorization header as a Bearer token.

javascript-fullstack's People

Contributors

montsouz avatar

Watchers

 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.