{"id":27294912,"url":"https://github.com/seyla123/auth-fullstack-nextjs","last_synced_at":"2025-04-11T22:57:52.085Z","repository":{"id":264136876,"uuid":"892476296","full_name":"Seyla123/auth-fullstack-nextjs","owner":"Seyla123","description":"Custom Next.js Authentication System with JWT, SQLite, and Tailwind CSS A full-stack authentication solution featuring sign-ups, sign-ins, password management, email verification, and user invitations, built without third-party auth services.","archived":false,"fork":false,"pushed_at":"2024-11-28T14:37:41.000Z","size":5653,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-11T22:57:48.018Z","etag":null,"topics":["authentication","custom-authentication","full-stack","jwt","nextjs","nodejs","react","react-toolkit-query","shadcn-ui","sqlite","tailwind","web-development"],"latest_commit_sha":null,"homepage":"https://auth-fullstack-nextjs-five.vercel.app","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/Seyla123.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":"2024-11-22T07:23:15.000Z","updated_at":"2024-11-30T04:22:27.000Z","dependencies_parsed_at":"2024-11-22T08:39:24.050Z","dependency_job_id":null,"html_url":"https://github.com/Seyla123/auth-fullstack-nextjs","commit_stats":null,"previous_names":["seyla123/auth-fullstack-nextjs"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seyla123%2Fauth-fullstack-nextjs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seyla123%2Fauth-fullstack-nextjs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seyla123%2Fauth-fullstack-nextjs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Seyla123%2Fauth-fullstack-nextjs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Seyla123","download_url":"https://codeload.github.com/Seyla123/auth-fullstack-nextjs/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248492924,"owners_count":21113162,"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":["authentication","custom-authentication","full-stack","jwt","nextjs","nodejs","react","react-toolkit-query","shadcn-ui","sqlite","tailwind","web-development"],"created_at":"2025-04-11T22:57:51.506Z","updated_at":"2025-04-11T22:57:52.078Z","avatar_url":"https://github.com/Seyla123.png","language":"TypeScript","readme":"# Next.js Authentication Membership System\n\nThis project is a full-stack authentication membership system built entirely with **Next.js**, featuring server-side APIs and frontend functionality. It uses **JWT** for authentication, **SQLite** for database management, and **Brevo (Sendinblue)** for sending emails. The system is designed for universal API usage without relying on third-party authentication libraries.\n\n\n\n\n## Features\n\n\n### Authentication\n- **Sign Up**: Users can register and receive a verification email.\n![Screenshot 2024-11-28 at 8 14 09 PM](https://github.com/user-attachments/assets/95275cf3-61d0-4482-b858-a3ee463de3bd)\n- **Sign In**: Secure login using email and password.\n ![Screenshot 2024-11-28 at 8 11 35 PM](https://github.com/user-attachments/assets/2fd16446-206f-4c76-9642-3617f971ca6c)\n- **Email Verification**: Verify email addresses (resend verification limited to 3 times per day).\n- **Forgot Password**: Request a password reset email.\n- **Reset Password**: Securely update passwords via a reset token.\n- **Change Password**: Change the current password from within the user account.\n  \n\n\n\n### User Invitations\n- **Invite Users**:\n ![Screenshot 2024-11-28 at 8 15 55 PM](https://github.com/user-attachments/assets/a3d7da1a-1aa1-4d3c-a3d4-24337cd7544f)\n  - Two roles: **Admin** and **User**.\n  - Newly registered users are assigned the **User** role by default.\n  - Invited users receive a verification email and can register via an invite link.\n  - Invites are validated before allowing the user to register.\n\n---\n\n## Tech Stack\n\n### Frontend\n- **Framework**: [Next.js](https://nextjs.org/)\n- **Styling**: \n  - [Tailwind CSS](https://tailwindcss.com/) for utility-first styling.\n  - [Chadcn UI](https://ui.shadcn.com/) for component-based styling.\n- **State Management \u0026 API Calls**: [React Toolkit Query](https://redux-toolkit.js.org/rtk-query/overview) for efficient data fetching and caching.\n\n### Backend\n- **Framework**: Next.js API routes (`/api/...`) for server-side functionality.\n- **Database**: [SQLite](https://www.sqlite.org/index.html) for lightweight, file-based database management.\n- **Authentication**: [JWT (JSON Web Tokens)](https://jwt.io/).\n- **Email Service**: [Brevo (Sendinblue)](https://www.brevo.com/) for transactional emails.\n\n---\n\n## Installation\n\n### Prerequisites\nEnsure you have the following installed:\n- [Node.js](https://nodejs.org/) (version 16 or above)\n- [npm](https://www.npmjs.com/) (or Yarn)\n\n### Steps\n\n1. **Clone the Repository**:\n   ```bash\n   git clone https://github.com/your-username/your-repo-name.git\n   cd your-repo-name\n   ```\n2. **Install Dependencies**:\n   ```bash\n   npm install\n   ```\n3. **Set Up Environment Variables**: Create a .env.local file in the root directory and include the following:\n  ```\n# .env file for SQLite database in Next.js\nDATABASE_URL=\"database.sqlite\"\n\n# Environment Mode\nNODE_ENV=\n\n# JWT Secret\nJWT_SECRET=\nJWT_EXPIRES_IN=\nJWT_COOKIE_EXPIRES_IN=\nJWT_INVITE_EXPIRES_IN=\nJWT_EMAIL_VERIFY_TOKEN_EXPIRES_IN=\nJWT_RESET_PASSWORD_TOKEN_EXPIRES_IN=\n\n# brevo\nBREVO_EMAIL=\nBREVO_API_KEY=\n```\n4. **Start the Development Server**:\n   ```\n   npm run dev\n   ```\n5. **Access the Application**: Open http://localhost:3000 in your browser.\n\n## API Endpoints\n\n### Auth\n- `POST /api/auth/signup` - Register a new user and send a verification email.\n- `POST /api/auth/signin` - Login with email and password.\n- `GET /api/auth/verify-reset-password-token` - Verify the reset password token.\n- `GET /api/auth/get-me` - Retrieve the current authenticated user's information.\n- `GET /api/auth/init-db` - Initialize the database (for development purposes).\n- `POST /api/auth/signout` - Sign out the current user.\n- `PATCH /api/auth/change-password` - Change the current user's password.\n- `POST /api/auth/forgot-password` - Request a password reset email.\n- `POST /api/auth/reset-password` - Reset the user's password using a valid token.\n- `POST /api/auth/verify-user-signup` - Verify the user's email after signing up.\n- `GET /api/auth/resend-verify-email` - Resend the email verification link.\n\n### Admin \u003e Users\n#### Invite\n- `POST /api/admin/invite` - Invite a new user with a specified role (`Admin` or `User`).\n- `GET /api/admin/invite` - Retrieve all invited users.\n- `GET /api/admin/invite/verify-token` - Verify an invitation token.\n- `DELETE /api/admin/invite` - Delete an invitation.\n- `GET /api/admin/invite/resend-link` - Resend the invitation email.\n\n#### Register by Invited Link\n- `GET /api/admin/register` - Register a new user using an invitation link.\n\n#### User Management\n- `GET /api/admin/users` - Retrieve all users.\n- `GET /api/admin/users/:id` - Retrieve details of a specific user by ID.\n- `DELETE /api/admin/users/:id` - Delete a specific user by ID.\n\n---\n\n## Project Structure\n\n```\n.                 \n├── app                      \n│   ├── (auth)               \n│   │   ├── forgot-password   \n│   │   ├── register-invited-user #\n│   │   ├── reset-password    \n│   │   ├── sign-in          \n│   │   ├── sign-up           \n│   │   ├── unauthorized    \n│   │   ├── verify-account    \n│   │   ├── verify-email     \n│   │   └── layout.tsx       \n│   ├── (root)                # General application pages\n│   │   ├── admin            \n│   │   │   ├── users       \n│   │   │   └── layout.tsx    \n│   │   └── page.tsx         \n│   ├── api                   # API routes for backend functionalities\n│   │   ├── admin             \n│   │   ├── auth              \n│   │   ├── initDb         \n│   │   ├── send-email        \n│   │   └── route.ts          \n│   ├── fonts                 \n│   ├── providers             # Context or state providers\n│   ├── favicon.ico          \n│   ├── globals.css          \n│   ├── layout.tsx           \n│   └── not-found.tsx        \n├── components                \n├── data                     \n├── hooks                    \n├── lib                       \n├── middlewares               \n├── public                               \n├── .eslintrc.json            \n├── .gitignore               \n├── components.json           \n├── Dockerfile               \n├── middleware.ts            \n├── next-env.d.ts            \n├── next.config.ts            \n├── package-lock.json       \n├── package.json              \n├── postcss.config.mjs       \n├── tailwind.config.ts       \n├── tsconfig.json             \n└── README.md                 \n```\n## Contributing\n\nContributions are welcome! Feel free to fork the repository and submit a pull request.\n\n## License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n## Acknowledgments\n\n- [Next.js](https://nextjs.org/)\n- [Tailwind CSS](https://tailwindcss.com/)\n- [Sendinblue/Brevo](https://www.brevo.com/)\n- [RTK Query](https://redux-toolkit.js.org/rtk-query/overview)\n\n---\n\nThank you for checking out this project! Feedback and suggestions are always welcome.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseyla123%2Fauth-fullstack-nextjs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fseyla123%2Fauth-fullstack-nextjs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fseyla123%2Fauth-fullstack-nextjs/lists"}