{"id":24824345,"url":"https://github.com/nxtninja/sso-auth-monorepo","last_synced_at":"2026-04-10T20:56:07.978Z","repository":{"id":274698842,"uuid":"922890041","full_name":"NxtNinja/sso-auth-monorepo","owner":"NxtNinja","description":"SSO Auth is a secure and efficient Single Sign-On (SSO) authentication system built with Fastify, Next.js, PostgreSQL, and Prisma. It supports JWT-based authentication, protected routes, and seamless login across multiple frontends","archived":false,"fork":false,"pushed_at":"2025-01-29T04:34:45.000Z","size":121,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-29T05:25:57.039Z","etag":null,"topics":["fastify","nextjs","turborepo"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NxtNinja.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-27T09:18:58.000Z","updated_at":"2025-01-29T04:34:49.000Z","dependencies_parsed_at":"2025-01-28T21:45:34.757Z","dependency_job_id":null,"html_url":"https://github.com/NxtNinja/sso-auth-monorepo","commit_stats":null,"previous_names":["nxtninja/todo-monorepo","nxtninja/sso-auth-monorepo"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtNinja%2Fsso-auth-monorepo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtNinja%2Fsso-auth-monorepo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtNinja%2Fsso-auth-monorepo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NxtNinja%2Fsso-auth-monorepo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NxtNinja","download_url":"https://codeload.github.com/NxtNinja/sso-auth-monorepo/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245556980,"owners_count":20634896,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastify","nextjs","turborepo"],"created_at":"2025-01-30T20:29:26.961Z","updated_at":"2026-04-10T20:56:07.921Z","avatar_url":"https://github.com/NxtNinja.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SSO Auth\n\nFastify SSO Auth is a **Single Sign-On (SSO) authentication system** designed to provide seamless authentication across multiple applications. It is built with **Fastify, Next.js, PostgreSQL, and Prisma**, and uses **Turborepo** for managing a monorepo structure.\n\n![Authentication Flow](images/AUTH_SSO.png)\n\n## 🚀 Features\n\n- **SSO Authentication** using JWT and cookies.\n- **Fast and lightweight** authentication backend with Fastify.\n- **Protected routes** with authentication middleware.\n- **Full-stack monorepo** managed with Turborepo.\n- **Seamless login persistence** across multiple frontends.\n- **PostgreSQL database** managed with Prisma.\n- **CORS and security** configured for cross-origin authentication.\n\n---\n\n## 🛠 Tech Stack\n\n- **Backend:** Fastify, Fastify JWT, Prisma, PostgreSQL\n- **Frontend:** Next.js (for multiple frontends)\n- **Monorepo Management:** Turborepo\n- **Authentication:** JWT, Cookies, Fastify Auth\n\n---\n\n## 📂 Project Structure\n\nThis project follows a monorepo structure managed by **Turborepo**:\n\n```\nrepo-root/\n├── apps/\n│   ├── auth-server/        # Fastify authentication backend\n│   ├── server/             # Fastify backend for service 1\n│   ├── server-second/      # Fastify backend for service 2\n│   ├── web/                # First Next.js frontend\n│   ├── web-second/         # Second Next.js frontend\n│\n├── packages/\n│   ├── ui/            # Shared UI components\n│   ├── config/        # Shared configuration (e.g., Tailwind, ESLint)\n│\n├── turbo.json         # Turborepo configuration\n└── package.json       # Root package.json with workspace dependencies\n```\n\n## 🔐 Authentication Flow\n\n1. **User logs in** → Backend issues a **JWT** stored in an **HTTP-only cookie**.\n2. **Frontend apps send requests** with the cookie for authentication.\n3. **Protected routes** validate the JWT before granting access.\n4. **Logout** clears the authentication token.\n5. **If logged in on one frontend**, another frontend recognizes the authentication status automatically.\n\n### 🚀 Happy Coding!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxtninja%2Fsso-auth-monorepo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnxtninja%2Fsso-auth-monorepo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnxtninja%2Fsso-auth-monorepo/lists"}