Coder Social home page Coder Social logo

renanfachin / rs_fs_saas-rbac-next Goto Github PK

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

Aplicação fullstack de um SaaS (Software as a Service), multi-tenant e que utiliza a estratégia de permissões por cargos (RBAC)

JavaScript 1.31% TypeScript 98.69%
rbac saas-application rocketseat monorepo

rs_fs_saas-rbac-next's Introduction

Next.js SaaS + RBAC

This project contains all the necessary boilerplate to setup a multi-tenant SaaS with Next.js including authentication and RBAC authorization.

Features

Authentication

  • It should be able to authenticate using e-mail & password;
  • It should be able to authenticate using Github account;
  • It should be able to recover password using e-mail ;
  • It should be able to create an account (e-mail, name and password);

Organizations

  • It should be able to create a new organization;
  • It should be able to get organizations to which the user belongs;
  • It should be able to update an organization;
  • It should be able to shutdown an organization;
  • It should be able to transfer organization ownership;

Invites

  • It should be able to invite a new member (e-mail, role);
  • It should be able to accept an invite;
  • It should be able to revoke a pending invite;

Members

  • It should be able to get organization members;
  • It should be able to update a member role;

Projects

  • It should be able to get projects within a organization;
  • It should be able to create a new project (name, url, description);
  • It should be able to update a project (name, url, description);
  • It should be able to delete a project;

Billing

  • It should be able to get billing details for organization ($20 per project / $10 per member excluding billing role);

RBAC

Roles & permissions.

Roles

  • Owner (count as administrator)
  • Administrator
  • Member
  • Billing (one per organization)
  • Anonymous

Permissions table

Administrator Member Billing Anonymous
Update organization
Delete organization
Invite a member
Revoke an invite
List members
Transfer ownership ⚠️
Update member role
Delete member ⚠️
List projects
Create a new project
Update a project ⚠️
Delete a project ⚠️
Get billing details
Export billing details

✅ = allowed ❌ = not allowed ⚠️ = allowed w/ conditions

Conditions

  • Only owners may transfer organization ownership;
  • Only administrators and project authors may update/delete the project;
  • Members can leave their own organization;

Executando o projeto

Back-end

Realizar o clone da aplicação

git clone https://github.com/RenanFachin/RS_FS_SaaS-rbac-next.git

Acessar a pasta da api (apps/api)

Instalar dependências

npm i

Subir o serviço do PostgreSQL via docker

docker compose up -d

Copiar o arquivo com os dados de conexão e demais variáveis ambiente

cp .env.example .env

Criar as tabelas do banco de dados (em desenvolvimento)

npx prisma migrate dev

Populando o banco de dados

npm prisma db seed

Execute o projeto

npm run dev

Visualizando a DOCUMENTAÇÃO do projeto http://localhost:3333/docs/

Documentação com Swagger

Visualizando o banco de dados

npx prisma studio

Criar as tabelas do banco de dados (em produção)

npx prisma migrate deploy

rs_fs_saas-rbac-next's People

Contributors

renanfachin avatar turbobot-temp 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.