{"id":28461446,"url":"https://github.com/jorgesarricolea/authcore","last_synced_at":"2026-04-11T04:33:59.177Z","repository":{"id":297142045,"uuid":"995761391","full_name":"JorgeSarricolea/authcore","owner":"JorgeSarricolea","description":"Authentication microservice with JWT, Google OAuth, and email/password, built with Clean Architecture and Docker.","archived":false,"fork":false,"pushed_at":"2025-06-04T16:07:14.000Z","size":239,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-07-03T08:43:16.185Z","etag":null,"topics":["auth-service","authentication","docker","express","google","mysql","nodejs","oauth2","prisma-orm","types"],"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/JorgeSarricolea.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,"zenodo":null}},"created_at":"2025-06-04T01:15:23.000Z","updated_at":"2025-06-04T16:07:16.000Z","dependencies_parsed_at":"2025-06-08T04:31:47.608Z","dependency_job_id":null,"html_url":"https://github.com/JorgeSarricolea/authcore","commit_stats":null,"previous_names":["jorgesarricolea/authcore"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JorgeSarricolea/authcore","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeSarricolea%2Fauthcore","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeSarricolea%2Fauthcore/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeSarricolea%2Fauthcore/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeSarricolea%2Fauthcore/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JorgeSarricolea","download_url":"https://codeload.github.com/JorgeSarricolea/authcore/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JorgeSarricolea%2Fauthcore/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31669116,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-10T17:19:37.612Z","status":"online","status_checked_at":"2026-04-11T02:00:05.776Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["auth-service","authentication","docker","express","google","mysql","nodejs","oauth2","prisma-orm","types"],"created_at":"2025-06-07T03:30:47.071Z","updated_at":"2026-04-11T04:33:59.149Z","avatar_url":"https://github.com/JorgeSarricolea.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AuthCore\n\nAuthentication service with local and OAuth (Google) authentication support.\n\n## Features\n\n- Local authentication (email/password)\n- Google OAuth integration\n- Password reset functionality\n- Email verification\n- JWT-based authentication\n- Role-based access control (RBAC)\n- Predefined roles and permissions\n- Rate limiting\n- CORS support\n\n## API Documentation\n\nThe project includes HTTP request files (`api.http`) in the `src/interfaces/routes` directory for testing endpoints:\n\n- `auth.api.http`: Authentication-related endpoints\n- `app.api.http`: General application endpoints\n- `test.api.http`: Test endpoints for protected routes\n\n## Prerequisites\n\n- Node.js 20+\n- pnpm\n- Docker and Docker Compose\n\n## Setup\n\n1. Clone the repository\n2. Install dependencies:\n\n   ```bash\n   pnpm install\n   ```\n\n3. Copy `.env.example` to `.env` and update the variables\n\n4. Build and start the Docker containers:\n\n   ```bash\n   pnpm docker:build\n   pnpm docker:dev\n   ```\n\n5. After the containers are running, you need to grant database permissions. Connect to the MySQL container and execute the following commands:\n\n   ```bash\n   docker exec -it authcore_mysql_db mysql -uroot -p\n   ```\n\n\u003e [!IMPORTANT]\n\u003e When prompted, enter the root password from your .env file.\n\n6. Once inside MySQL, execute these commands:\n\n   ```sql\n   GRANT ALL PRIVILEGES ON *.* TO 'MYSQL_USER'@'%' WITH GRANT OPTION;\n   FLUSH PRIVILEGES;\n   ```\n\n\u003e [!IMPORTANT]\n\u003e Remember to change **MYSQL_USER** for the user you're going to use.\n\n7. Exit MySQL:\n\n   ```sql\n   exit\n   ```\n\n8. Run the Prisma migrations and seed the database:\n\n   ```bash\n   pnpm prisma:generate\n   pnpm prisma:migrate:dev\n   pnpm prisma:seed\n   ```\n\n## Available Scripts\n\n- `pnpm dev`: Start development server\n- `pnpm build`: Build the project\n- `pnpm start`: Start production server\n- `pnpm docker:build`: Build Docker containers\n- `pnpm docker:dev`: Start Docker containers\n- `pnpm docker:down`: Stop Docker containers\n- `pnpm docker:logs`: View Docker container logs\n- `pnpm prisma:generate`: Generate Prisma client\n- `pnpm prisma:migrate:dev`: Run database migrations\n- `pnpm prisma:migrate:reset`: Reset database\n- `pnpm prisma:migrate:rollback`: Rollback last migration\n- `pnpm prisma:seed`: Seed the database with initial data\n\n## Environment Variables\n\n#### Application Settings\n\n- `PORT`: Server port number (default: 8000)\n\n  ```\n  PORT=\"8000\"\n  ```\n\n- `NODE_ENV`: Environment (development/production)\n\n  ```\n  NODE_ENV=\"development\"\n  ```\n\n- `APP_NAME`: Name of your application\n\n  ```\n  APP_NAME=\"AuthCore\"\n  ```\n\n- `COMPOSE_PROJECT_NAME`: Docker Compose project name\n\n  ```\n  COMPOSE_PROJECT_NAME=\"authcore_server\"\n  ```\n\n- `ALLOWED_ORIGINS`: Comma-separated list of allowed origins for CORS\n\n  ```\n  ALLOWED_ORIGINS=\"http://localhost:3000,https://yourdomain.com\"\n  ```\n\n- `API_URL`: Base URL for the API endpoints\n  ```\n  API_URL=\"http://localhost:8000/api/v1\"\n  ```\n\n#### Database Configuration\n\n- `DATABASE_URL`: MySQL connection URL\n\n  ```\n  DATABASE_URL=\"mysql://user:password@localhost:3306/database\"\n  ```\n\n- `MYSQL_USER`: MySQL user\n\n  ```\n  MYSQL_USER=\"user\"\n  ```\n\n- `MYSQL_PASSWORD`: MySQL password\n\n  ```\n  MYSQL_PASSWORD=\"password\"\n  ```\n\n- `MYSQL_ROOT_PASS`: MySQL root password\n\n  ```\n  MYSQL_ROOT_PASS=\"root_password\"\n  ```\n\n- `MYSQL_DB`: MySQL database name\n\n  ```\n  MYSQL_DB=\"authcore\"\n  ```\n\n- `MYSQL_PORT`: MySQL port (default: 3306)\n  ```\n  MYSQL_PORT=\"3306\"\n  ```\n\n#### JWT Configuration\n\n- `JWT_SECRET`: Secret key for access tokens\n\n  ```\n  JWT_SECRET=\"your-jwt-secret\"\n  ```\n\n- `JWT_REFRESH_SECRET`: Secret key for refresh tokens\n  ```\n  JWT_REFRESH_SECRET=\"your-jwt-refresh-secret\"\n  ```\n\n#### Email Configuration\n\n- `SMTP_HOST`: SMTP server host\n\n  ```\n  SMTP_HOST=\"smtp.gmail.com\"\n  ```\n\n- `SMTP_PORT`: SMTP server port\n\n  ```\n  SMTP_PORT=\"587\"\n  ```\n\n- `SMTP_SECURE`: Whether to use TLS (true for port 465, false for port 587)\n\n  ```\n  SMTP_SECURE=\"false\"\n  ```\n\n- `SMTP_USER`: SMTP username/email\n\n  ```\n  SMTP_USER=\"your-email@gmail.com\"\n  ```\n\n- `SMTP_PASSWORD`: SMTP password or app-specific password\n  ```\n  SMTP_PASSWORD=\"your-password\"\n  ```\n\n#### Google OAuth\n\n- `GOOGLE_CLIENT_ID`: Google OAuth client ID\n\n  ```\n  GOOGLE_CLIENT_ID=\"your-client-id\"\n  ```\n\n- `GOOGLE_CLIENT_SECRET`: Google OAuth client secret\n\n  ```\n  GOOGLE_CLIENT_SECRET=\"your-client-secret\"\n  ```\n\n- `GOOGLE_CALLBACK_URL`: OAuth callback URL\n  ```\n  GOOGLE_CALLBACK_URL=\"http://localhost:8000/api/v1/auth/google/callback\"\n  ```\n\n### Setting up Google OAuth Credentials\n\nTo obtain the Google OAuth credentials, follow these steps:\n\n1. Go to the [Google Cloud Console](https://console.cloud.google.com/)\n2. Create a new project or select an existing one\n3. Navigate to \"APIs \u0026 Services\" \u003e \"Credentials\"\n4. Click on \"Create Credentials\" and select \"OAuth client ID\"\n5. Select \"Web application\" as the application type\n6. Add a name for your OAuth client\n7. Add authorized JavaScript origins:\n   ```\n   http://localhost:8000\n   ```\n8. Add authorized redirect URIs:\n   ```\n   http://localhost:8000/api/v1/auth/google/callback\n   ```\n9. Click \"Create\"\n10. Copy the generated Client ID and Client Secret\n11. Update your `.env` file with these values:\n    ```\n    GOOGLE_CLIENT_ID=\"your-client-id\"\n    GOOGLE_CLIENT_SECRET=\"your-client-secret\"\n    GOOGLE_CALLBACK_URL=\"http://localhost:8000/api/v1/auth/google/callback\"\n    ```\n\n\u003e [!NOTE]\n\u003e Make sure to enable the Google+ API in your Google Cloud Console project before using OAuth.\n\n## Predefined Roles and Permissions\n\nThe system comes with the following predefined roles:\n\n1. **SUPER_ADMIN**\n\n   - Full system access\n   - All permissions\n\n2. **ADMIN**\n\n   - Elevated access\n   - Most permissions except system configuration\n\n3. **MANAGER**\n\n   - Resource management capabilities\n   - Create, read, update, manage, and approve permissions\n\n4. **USER**\n\n   - Basic access\n   - Read-only permissions\n\n5. **AUDITOR**\n   - System audit capabilities\n   - Read and audit permissions\n\n## Contributing\n\n1. Fork the repository\n2. Create your feature branch (`git checkout -b feature/amazing-feature`)\n3. Commit your changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgesarricolea%2Fauthcore","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjorgesarricolea%2Fauthcore","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjorgesarricolea%2Fauthcore/lists"}