Giter Site home page Giter Site logo

mango-kit's Introduction

Deno Backend Starter Pack

Requirement

  • Deno
  • Postgresql
  • Redis

Documentation

Authentication & Authorization

Authentication are using jwt token and google oauth2 to setup user information.

Authorization use redis to save session and revoke token.

See more API authentication in packages/auth/router/auth-router.ts

  • /v1/auth/callback/google/verify - Verify google token and return jwt token
  • /v1/auth/refresh-token - Refresh jwt token
  • /v1/auth/logout - Logout and revoke jwt token

JWT Key

JWT key are using RSA key pair. You can generate key pair by using this command

deno run -A packages/auth/scripts/generate-key.ts

Folder Structure

  • packages : packages tools and library
  • src : source code
    • middleware : middleware for server
    • module : module for feature or api
      • mod.ts : assign your controller here
      • [module name] : module folder
        • controller : controller for module
        • service : service for module
      • repository : repository for database
    • migrations : migration for database
    • config.ts : config for server
    • db.ts : initialize your database here
    • fn.ts : helper function
    • logger.ts : logger for server
    • type.ts : type for development
    • main.ts : main file for server

Env file

You can create .env file in root folder to setup environment variable.

ENV=development
PORT=8080

DB_HOST=
DB_PORT=
DB_USER=
DB_PASSWORD=
DB_DATABASE=

REDIS_HOST=
REDIS_PORT=
REDIS_PASSWORD=

// required for auth
LOCATION_KEY_AUTH=auth.key

Commands

Deno run

deno task dev

Migration

Up migration

deno task migrate:up

Down migration

deno task migrate:down

Create migration

deno task migrate:new [migration-name]

List migration

deno task migrate:list

Docker up

docker compose up -d

mango-kit's People

Stargazers

Haikel avatar Muhammad Zakir Ramadhan  avatar Muhammad Jamal Luthfi avatar Robi Irhamni avatar Cintara Surya Elidanto avatar M Haidar Hanif avatar

Watchers

Rio Chandra 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.