{"id":25469878,"url":"https://github.com/thinkphp/auth2","last_synced_at":"2026-04-10T03:00:54.823Z","repository":{"id":273514731,"uuid":"919873958","full_name":"thinkphp/Auth2","owner":"thinkphp","description":"Auth React Frontend Backend Node.js Sqlite3","archived":false,"fork":false,"pushed_at":"2025-01-21T10:47:33.000Z","size":6707,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-17T14:42:20.646Z","etag":null,"topics":["authentication","backend","bcrypt","cors","express","frontend","node","react","router","sqlite","tailwindcss"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/thinkphp.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-21T07:03:12.000Z","updated_at":"2025-01-23T05:04:42.000Z","dependencies_parsed_at":null,"dependency_job_id":"a31d0095-a596-42c3-b210-29185dab3ce3","html_url":"https://github.com/thinkphp/Auth2","commit_stats":null,"previous_names":["thinkphp/auth2"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/thinkphp/Auth2","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FAuth2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FAuth2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FAuth2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FAuth2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thinkphp","download_url":"https://codeload.github.com/thinkphp/Auth2/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thinkphp%2FAuth2/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267334258,"owners_count":24070533,"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","status":"online","status_checked_at":"2025-07-27T02:00:11.917Z","response_time":82,"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":["authentication","backend","bcrypt","cors","express","frontend","node","react","router","sqlite","tailwindcss"],"created_at":"2025-02-18T08:31:08.385Z","updated_at":"2026-04-10T03:00:54.699Z","avatar_url":"https://github.com/thinkphp.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Authentication System with Welcome Page\n\nA simple authentication system built with React and Node.js, featuring user registration, login, and a welcome page.\n\n## Features\n\n- User registration with username and email\n- User login with email and password\n- Protected welcome page\n- Session management using localStorage\n- Responsive design using Tailwind CSS\n\n## Tech Stack\n\n### Frontend\n- React\n- React Router DOM\n- Tailwind CSS\n\n### Backend\n- Node.js\n- Express.js\n- SQLite3\n- bcrypt\n\n## Setup Instructions\n\n### Backend Setup\n\n1. Create project directory:\n```bash\nmkdir auth-system\ncd auth-system\nmkdir server\ncd server\n```\n\n2. Initialize Node.js project:\n```bash\nnpm init -y\n```\n\n3. Install dependencies:\n```bash\nnpm install express sqlite3 bcrypt cors\n```\n\n4. Create server.js and add the following code:\n```javascript\nconst express = require('express');\nconst sqlite3 = require('sqlite3').verbose();\nconst bcrypt = require('bcrypt');\nconst cors = require('cors');\n\nconst app = express();\napp.use(express.json());\napp.use(cors());\n\n// Database setup\nconst db = new sqlite3.Database('users.db');\n\n// Create users table\ndb.run(`\n    CREATE TABLE IF NOT EXISTS users (\n        id INTEGER PRIMARY KEY AUTOINCREMENT,\n        username TEXT UNIQUE NOT NULL,\n        email TEXT UNIQUE NOT NULL,\n        password TEXT NOT NULL,\n        created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n    )\n`);\n\n// Routes for register and login\n// ... (copy from server code)\n\napp.listen(5000, () =\u003e console.log('Server running on port 5000'));\n```\n\n### Frontend Setup\n\n1. Create React project:\n```bash\ncd ..\nnpm create vite@latest client -- --template react\ncd client\n```\n\n2. Install dependencies:\n```bash\nnpm install react-router-dom\nnpm install -D tailwindcss postcss autoprefixer\nnpx tailwindcss init -p\n```\n\n3. Configure Tailwind CSS in `tailwind.config.js`:\n```javascript\n/** @type {import('tailwindcss').Config} */\nexport default {\n  content: [\n    \"./index.html\",\n    \"./src/**/*.{js,ts,jsx,tsx}\",\n  ],\n  theme: {\n    extend: {},\n  },\n  plugins: [],\n}\n```\n\n4. Add to `src/index.css`:\n```css\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n```\n\n## Project Structure\n\n```\nauth-system/\n├── server/\n│   ├── server.js\n│   ├── package.json\n│   └── users.db\n└── client/\n    ├── src/\n    │   ├── components/\n    │   │   ├── Auth.jsx\n    │   │   └── WelcomePage.jsx\n    │   ├── App.jsx\n    │   └── index.css\n    └── package.json\n```\n\n## Running the Application\n\n1. Start the backend:\n```bash\ncd server\nnode server.js\n```\n\n2. Start the frontend (in a new terminal):\n```bash\ncd client\nnpm run dev\n```\n\n## API Endpoints\n\n### Register User\n```bash\nPOST http://localhost:5000/api/register\nContent-Type: application/json\n\n{\n    \"username\": \"john_doe\",\n    \"email\": \"john@example.com\",\n    \"password\": \"password123\"\n}\n```\n\n### Login User\n```bash\nPOST http://localhost:5000/api/login\nContent-Type: application/json\n\n{\n    \"email\": \"john@example.com\",\n    \"password\": \"password123\"\n}\n```\n\n## Database Management\n\nView database contents:\n```bash\nsqlite3 users.db\n.tables\nSELECT * FROM users;\n```\n\n## Local Storage\n\nThe application stores user session data in localStorage:\n- Key: `'user'`\n- Value: `{ id, username, email }`\n\n## Security Features\n\n- Password hashing using bcrypt\n- Protected routes in frontend\n- Form validation\n- Error handling for duplicate email/username\n\n## Common Issues\n\n1. Server Connection Error\n   - Ensure server is running on port 5000\n   - Check CORS configuration\n\n2. Database Issues\n   - Verify SQLite3 is installed\n   - Check file permissions for users.db\n\n3. Login Issues\n   - Clear localStorage and try again\n   - Verify email and password combination\n\n## Future Improvements\n\n- Add JWT authentication\n- Implement password reset\n- Add email verification\n- Enhanced error handling\n- Add user profile management\n\n## License\n\nMIT License\n\n\nThis README focuses solely on the authentication system and includes:\n1. Clear setup instructions\n2. Essential features\n3. API documentation\n4. Database setup\n5. Common troubleshooting steps\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fauth2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkphp%2Fauth2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkphp%2Fauth2/lists"}