A minimal notes app where users can login using their Github, Google and Facebook accounts.
This project is a monorepo that contains both the client and server code. The client is a PWA built with Vite and uses React Router, and the server is an Express application. The data is stored in a PostgreSQL database.
It conforms to the OAuth 2.0 (and OpenID Connect) standards, upon successful consent from the user to access their basic data from the OAuth 2.0 providers, the backend checks whether the user's OAuth provider's ID already exists in the database, if not, we sign them up, otherwise we log them in.
Upon successful login, the backend sets an HttpOnly
cookie that contains a JSONWebToken (JWT), the JWT is used to authorize users access to the app.
- Frontend:
TypeScript
,React
,React Router
,ShadCN UI
,TailwindCSS
- Backend:
TypeScript
,Express.js
,PostgreSQL
,JSONWebToken
,OAuth 2.0
,OpenID Connect
Both the client and server are deployed to an EC2 instance (Amazon Linux 2023), you can deploy this anywhere you want on any Node.js host provider. To deploy on EC2, follow these steps.
- Create a
.env.production
of the client project, andconfig.env
of the server project, refer to the respective example configuration files. - Create client credentials on each OAuth providers (Github, Google and Facebook) and copy them to the environment variables of the server project.
- Setup a PostgreSQL database, and copy its credentials to the environment variables of the server project.
- Run
npm run pm2
on both the client and server projects.