Skip to content

About

Universiteams: Pro Scientific Dissemination

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

892 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Universiteams

dockeri.co

This project was thought in order to facilitate the creation, management and formalization of university research projects. Both students and teachers will be able to organize their projects, which will be visible to other students who may want to join the research team. It mainly consists of a web application, the main page will contain all the projects in order to make them known for everyone, and they will be accepting requests for those who want to get in.

Our main purpose is to facilitate and promote scientific dissemination.

Enrollment

A user joins a project in one of two ways. Both end with an accepted enrollment, which makes the user a project member.

  • Request: the user asks to join (POST /projects/:id/enroll-request), and a project admin or leader approves or rejects it (PUT /projects/:id/enroll-requests/:userId/approve|reject).
  • Invitation: a project admin or leader invites the user (POST /projects/:id/invitations/:userId), and can edit or cancel the invitation (PUT and DELETE on the same route). Admins and leaders list the project's pending and declined invitations with GET /projects/:id/invitations. The invited user accepts or declines it (PUT /projects/:id/invitation/accept|decline) and gets an email when invited.

Only admins and leaders whose enrollment is accepted can manage requests and invitations. Every route, with its body and responses, is in Swagger at http://api.localhost/docs.

Prerequisites

Make

Only in case you happen to use Windows install Chocolatey package manager Then install Make with the following command:

$ choco install make

Docker

https://docs.docker.com/get-docker/

NPM

Just if you happen to use VSCode linter and formatter extensions Alternatively, using VSCode remote docker container extension might provide the same experience

https://docs.npmjs.com/downloading-and-installing-node-js-and-npm

Local Environment

Setup

Create docker.dev.env once by copying the example and replacing the change-me values:

$ cp docker.dev.env.example docker.dev.env

Placeholder values are enough to run the app locally; sending emails (verification, password reset) needs a real SENDINBLUE_API_KEY.

Alternatively, ./create-env-file.sh ENV=dev KEY=VALUE ... generates the file from arguments (see the script for the full list). Arguments end up in your shell history, so prefer copying the example for real secrets.

The login cookies follow SAME_SITE_POLICY (strict, lax or none) and SECURE_COOKIE (true or false); the API refuses to start on any other value. In dev the frontend proxies the API through its own server (http://localhost:3000/api, active when BACKEND_PROXY_TARGET is set in the frontend's .env.local, see the frontend README), so the cookies are first-party and dev uses lax + false. Safari drops Secure cookies on http://localhost. If your docker.dev.env predates this, set those two values and recreate the API container (docker compose -p dev -f docker-compose.dev.yml up -d --force-recreate app).

Docker Desktop (or another Docker Engine) must be running.

Running the app

$ make dev

Migrations are executed by default when the app is bootstrapping

Access

API

api.localhost (Swagger docs at api.localhost/docs)

Sessions live in two HttpOnly cookies set on login: accessToken (15 minutes) and refreshToken (7 days). When the access token has expired or its cookie is gone, GET /auth/me and every authenticated route renew the session with a valid refresh token and send fresh cookies in the response. Logging out revokes the refresh token.

DB Admin

db.localhost (pgAdmin; the dev login is set in docker-compose.dev.yml)

Teardown

$ make down-dv

Production Environment

Setup and Running the app

$ make prod

Access

api.universiteams.com

Teardown

$ make down-pd

Test

Tests run in Docker and need docker.test.env. Create it once with:

$ ./create-test-env-file.sh
# unit tests
$ make test

# unit test [interactive debug mode]
$ make test-dg

# unit test coverage
$ make cov

# e2e tests
$ make e2e

# e2e tests [non-interactive debug mode]
$ make e2e-dg name="jest_test_partial_description"

Lint

# fix
make lint

# check only (as CI does)
make lint-check

Format

# fix
make format

# check only (as CI does)
make format-check

Technologies used

Frontend

Name How it contributes to the project
👔 TypeScript Programming language that builds on JavaScript
🚀 Next.js Fullstack framework for React.js
🧺 Mantine Really cool component library
🦴 HTML5 & CSS3 The basics for the web!
🎨 Sass CSS Simple stylization
🖼️ Tabler Icons Icons Mantine-compatible
📇 React-PDF Make customizable PDF reports
🖌️ Prettier Nice code formatter
📐 ESLint Complete linter with strict rules
🦮 Husky Git hooks to assure quality commits
🧪 Jest Easy unit testing
📦 TurboPack JavaScript very fast bundler
📃 GitHub Actions CI/CD automation
🔼 Deploy in Vercel Deployment is very important!

Backend

Name How it contributes to the project
👔 TypeScript Programming language that builds on JavaScript
📗 Node.js JavaScript runtime built on V8 JavaScript engine
🐱 Nest.js Framework for building efficient, scalable Node.js web apps
🗺️ TypeORM Object-relational mapping (ORM) tool for Node.js
🗃️ PostgreSQL Open-source relational database management system (RDBMS)
💾 JSON Web Token (JWT) Compact and self-contained way for securely transmitting info
🖌️ Prettier Nice code formatter
📐 ESLint Complete linter with strict rules
🧪 Jest Easy unit testing
⚗️ Supertest High-level HTTP abstraction for E2E integration testing
📖 Swagger Interactive, machine and human-readable API documentation
⚙️ Traefik HTTP reverse proxy and load balancer
🐳 Docker Separates the app from the infrastructure with containers
☁️ Terraform Infrastructure as code tool to manage the infra in any cloud
✈️ New Relic Monitor and analyze deployments
💧 DigitalOcean Droplet Deploy in scalable cloud virtual machines

Authors

Name GitHub Account
:octocat: Alejandro Recalde 🔗 https://github.com/alereca
:octocat: Nicolás Antonelli 🔗 https://github.com/NicoAntonelli
:octocat: Joshua Acciarri 🔗 https://github.com/JAcciarri

About

Universiteams: Pro Scientific Dissemination

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages