This is an open-source full-stack OAuth authentication system that's perfect for your next web application. Whether you're building a small project or a large-scale system, this repository provides a solid foundation to build upon.
The system is highly customizable and easy to use. Simply fork the repository and adjust the code to meet your specific requirements.
If you found this helpful, please consider starring the repo! ⭐
The "start" folder contains the user interface, while the "finished" folder includes all components of the project. The system is built using the following technologies:
Codebase | Description | Technologies |
---|---|---|
api | Node.js REST API | Node.js, Express, TypeScript, PostgreSQL, Prisma, Passport.js |
web | Next.js Frontend | Node.js, TypeScript, Next.js, Axios |
- Clone the repository to your local machine.
- Navigate to the
api
folder and runnpm install
to install the necessary dependencies. - Create a local PostgreSQL database and copy its database URL.
- Go to the GitHub Developer Settings or the Google Cloud Console (depending on what OAuth systems you want to include) and create the necessary OAuth application. Then, copy the
Client ID
andClient Secret
. - Create an
.env
file in theapi
folder (copying the existing template in.env.example
) with the following environment variables:API_PORT
: the port number for the API server (prefilled)CLIENT_URL
: the URL for the client-side of the application (prefilled)DATABASE_URL
: the URL to your PostgreSQL databaseSESSION_SECRET
: a secret key for Express session handlingGITHUB_CLIENT_ID
: the client ID for GitHub OAuth authenticationGITHUB_CLIENT_SECRET
: the secret key for GitHub OAuth authenticationGITHUB_CALLBACK_URL
: the callback URL for GitHub OAuth authentication (prefilled)GOOGLE_CLIENT_ID
: the client ID for Google OAuth authenticationGOOGLE_CLIENT_SECRET
: the secret key for Google OAuth authenticationGOOGLE_CALLBACK_URL
: the callback URL for Google OAuth authentication (prefilled)
- Run
npm run dev
to start the Node.js API. - Navigate to the
web
folder and runnpm install
to install the necessary dependencies. - Create a
.env
file with the contents of.env.example
. If you have the API running on the same port, it should work; otherwise, update it. - Run
npm run dev
to start the Next.js application. - Visit
http://localhost:3000
in your web browser to see the running application.