{"id":26460192,"url":"https://github.com/bereketkib/wonderlog-api","last_synced_at":"2026-04-13T04:43:18.884Z","repository":{"id":278791657,"uuid":"936781940","full_name":"bereketkib/wonderlog-api","owner":"bereketkib","description":"A robust RESTful API for the Wonderlog blogging platform, built with Node.js, Express, and Prisma.","archived":false,"fork":false,"pushed_at":"2025-02-22T18:44:55.000Z","size":35,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T01:14:00.937Z","etag":null,"topics":["expressjs","jsonwebtoken","nodejs","prisma","rest-api"],"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/bereketkib.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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-02-21T17:15:42.000Z","updated_at":"2025-02-22T18:44:58.000Z","dependencies_parsed_at":"2025-09-09T23:23:01.348Z","dependency_job_id":"42b22077-849d-4ea7-b47c-39f35e440038","html_url":"https://github.com/bereketkib/wonderlog-api","commit_stats":null,"previous_names":["bereketkib/wonderlog-api"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bereketkib/wonderlog-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bereketkib%2Fwonderlog-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bereketkib%2Fwonderlog-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bereketkib%2Fwonderlog-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bereketkib%2Fwonderlog-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bereketkib","download_url":"https://codeload.github.com/bereketkib/wonderlog-api/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bereketkib%2Fwonderlog-api/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31740266,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-13T03:27:07.512Z","status":"ssl_error","status_checked_at":"2026-04-13T03:26:53.610Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["expressjs","jsonwebtoken","nodejs","prisma","rest-api"],"created_at":"2025-03-19T02:48:47.043Z","updated_at":"2026-04-13T04:43:18.870Z","avatar_url":"https://github.com/bereketkib.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Wonderlog API\n\nA robust RESTful API for the Wonderlog blogging platform, built with Node.js, Express, and Prisma.\n\n## Related Repositories\n\n- [Wonderlog Web](https://github.com/bereketkib/wonderlog-web) - Main web application\n- [Wonderlog Dashboard](https://github.com/bereketkib/wonderlog-dashboard) - Author's dashboard\n\n## Features\n\n- User authentication with JWT\n- Role-based authorization (User and Author roles)\n- Blog post management with draft/publish functionality\n- Comment system\n- Pagination and search capabilities\n- Refresh token rotation\n- Error handling and validation\n\n## Tech Stack\n\n- Node.js\n- Express.js\n- Prisma ORM\n- PostgreSQL\n- JSON Web Tokens (JWT)\n- bcrypt for password hashing\n\n## API Endpoints\n\n### Authentication\n\n```bash\nPOST /auth/register     # Register a new user\nPOST /auth/login       # Login user\nDELETE /auth/logout    # Logout user\nPOST /auth/refresh     # Refresh access token\n```\n\n### Users\n\n```bash\nPOST /users/upgrade-to-author    # Upgrade user to author role\n```\n\n### Posts\n\n```bash\n# Public endpoints\nGET /posts            # Get all published posts\nGET /posts/:id        # Get a specific published post\n\n# Author endpoints\nGET /posts/my         # Get author's posts\nPOST /posts/my        # Create new post\nPUT /posts/my/:id     # Update post\nDELETE /posts/my/:id  # Delete post\n```\n\n### Comments\n\n```bash\nPOST /comments/:postId    # Create comment\nPUT /comments/:id        # Update comment\nDELETE /comments/:id     # Delete comment\nGET /comments/my         # Get user's comments\n```\n\n## Getting Started\n\n1. Clone the repository\n\n```bash\ngit clone https://github.com/yourusername/wonderlog-api.git\ncd wonderlog-api\n```\n\n````\n\n2. Install dependencies\n```bash\nnpm install\n````\n\n3. Set up environment variables\n\n```bash\ncp .env.example .env\n```\n\nRequired environment variables:\n\n```env\nDATABASE_URL=\"database-connection-url\"\nDIRECT_URL=\"direct-connection-url\"\nJWT_SECRET= \"your-jwt-secret\"\nREFRESH_SECRET= \"your-refresh-secret\"\nJWT_EXPIRY=\"15m\"\nREFRESH_EXPIRY=\"7d\"\nFRONT_END_URL1=\"your-first-front-end-url\"\nFRONT_END_URL2=\"your-second-front-end-url\"\nPORT=3000\n```\n\n````\n\n4. Run database migrations\n```bash\nnpx prisma migrate dev\n````\n\n5. Start the server\n\n```bash\nnpm run dev    # Development\nnpm start      # Production\n```\n\n## API Documentation\n\n### Authentication\n\nAll protected routes require a Bearer token in the Authorization header:\n\n```bash\nAuthorization: Bearer \u003cyour_jwt_token\u003e\n```\n\n### Response Format\n\nSuccess Response:\n\n```json\n{\n  \"data\": {},\n  \"message\": \"Operation successful\"\n}\n```\n\nError Response:\n\n```json\n{\n  \"status\": \"error\",\n  \"message\": \"Error description\"\n}\n```\n\n### Pagination\n\nEndpoints that return lists support pagination:\n\n```bash\nGET /posts?page=1\u0026limit=10\u0026search=keyword\n```\n\nResponse includes pagination metadata:\n\n```json\n{\n  \"posts\": [],\n  \"pagination\": {\n    \"total\": 100,\n    \"pages\": 10,\n    \"currentPage\": 1,\n    \"hasMore\": true\n  }\n}\n```\n\n## Error Handling\n\nThe API implements standard HTTP status codes:\n\n- 200: Success\n- 201: Created\n- 400: Bad Request\n- 401: Unauthorized\n- 403: Forbidden\n- 404: Not Found\n- 500: Internal Server Error\n\n## Security Features\n\n- JWT-based authentication\n- Password hashing with bcrypt\n- HTTP-only cookies for refresh tokens\n- Role-based access control\n- Input validation\n- Security headers\n- Rate limiting\n\n## Testing\n\nRun the test suite:\n\n```bash\nnpm test\n```\n\nTest API endpoints using the provided request collection:\n\n```bash\ntests/requests.rest\n```\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 amazing feature' )\n4. Push to the branch ( git push origin feature/amazing-feature )\n5. Open a Pull Request\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n\n## Author\n\nBereket Kibreab\n\n## Acknowledgments\n\n- Node.js community\n- Express.js team\n- Prisma team\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbereketkib%2Fwonderlog-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbereketkib%2Fwonderlog-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbereketkib%2Fwonderlog-api/lists"}