{"id":14975915,"url":"https://github.com/sohamratnaparkhi/blogx","last_synced_at":"2026-04-02T02:40:24.180Z","repository":{"id":171942475,"uuid":"648630827","full_name":"SohamRatnaparkhi/blogx","owner":"SohamRatnaparkhi","description":"Microservice based backend for a blogging platform. It has 4 services - authentication, blog, feed, and user. Swagger UI for these services is also available.","archived":false,"fork":false,"pushed_at":"2024-04-29T19:30:17.000Z","size":1061,"stargazers_count":4,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-09-27T21:05:25.619Z","etag":null,"topics":["backend","docker","docker-compose","go","haproxy","jwt","kubernetes","postgresql","redis","swagger-ui"],"latest_commit_sha":null,"homepage":"https://blogx-lilac.vercel.app","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SohamRatnaparkhi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-06-02T12:26:30.000Z","updated_at":"2024-04-29T19:30:20.000Z","dependencies_parsed_at":"2024-04-29T20:40:44.266Z","dependency_job_id":"0fe5d62b-87d6-4404-a7d2-0c247a85f367","html_url":"https://github.com/SohamRatnaparkhi/blogx","commit_stats":{"total_commits":161,"total_committers":1,"mean_commits":161.0,"dds":0.0,"last_synced_commit":"0632b25abc14dd527d6706906bbba9d837264be4"},"previous_names":["sohamratnaparkhi/blogx-backend-go","sohamratnaparkhi/blogx"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamRatnaparkhi%2Fblogx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamRatnaparkhi%2Fblogx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamRatnaparkhi%2Fblogx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SohamRatnaparkhi%2Fblogx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SohamRatnaparkhi","download_url":"https://codeload.github.com/SohamRatnaparkhi/blogx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219875657,"owners_count":16554696,"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":["backend","docker","docker-compose","go","haproxy","jwt","kubernetes","postgresql","redis","swagger-ui"],"created_at":"2024-09-24T13:52:51.394Z","updated_at":"2025-10-27T16:31:50.031Z","avatar_url":"https://github.com/SohamRatnaparkhi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# blogx-backend-go\n\nMicroservice based backend and Next.js frontend for a micro-blogging platform.\n\nIt offers four distinct API services that collectively enable various functionalities:\n\n- **Authentication**: This service facilitates essential operations such as user `login`, `logout`, and `registration`, ensuring secure access to the platform.\n- **Blog**: The Blog service provides features for managing blog-related activities. Users can `create`, `update`, and `delete` their blog posts. Additionally, they have the ability to `like` or `dislike` posts, promoting user engagement and feedback.\n- **User**: This service focuses on user-related interactions. It allows users to `follow` or `unfollow` other users, enabling social connections within the platform. Furthermore, users can `delete` their account if desired.\n- **Feed**: The Feed service is responsible for curating and displaying relevant content to users. It offers multiple options for customizing the feed, including displaying `all posts`, posts from `followed` authors, `liked` posts, posts by a specific user, or a `particular post`.\n- **Swagger -** You can access the Swagger UI at `localhost:8084/swagger/index.html`\n\nTry this API service in postman.\n\n[![Run in Postman](https://run.pstmn.io/button.svg)](https://app.getpostman.com/run-collection/25118959-d0fe8b6b-4aac-46af-b5b1-b557f0be7064?action=collection%2Ffork\u0026source=rip_markdown\u0026collection-url=entityId%3D25118959-d0fe8b6b-4aac-46af-b5b1-b557f0be7064%26entityType%3Dcollection%26workspaceId%3D572f4781-b67c-48e3-ae06-4fb3efc89053)\n\n## Local setup\n\n### Code-base Setup\n\n#### a) Backend setup\n\n1. Each folder of the root directory in the codebase contains an `.env.example` file. Follow the steps below to set up the necessary environment variables:\n\n* Create a file named .env in each folder.\n* Open the `.env.example` file and copy its contents.\n* Paste the copied contents into the corresponding `.env` file.\n* Replace the placeholder values in the .env file with the suggested values provided in the `.env.example` file.\n\n2. To set up the service locally, follow the steps below:\n\n* Clone the repository to your local machine.\n* Open a terminal and navigate to the cloned repository.\n* Create a network using the command `docker network create my-network`\n* Run the command `docker compose up`.\n\n\u003e **Note**: The `docker compose up` command will automatically set up the database. However, if it fails, please refer to the \"*DB-Setup*\" section for further instructions.\n\n#### b) Frontend setup\n\nFrontend is a Next.js 13.x application bootsrapped by `create-next-app`\n\nAfter cloning the project:\n\n* cd ./frontend\n* npm i\n* cp ./env.local.example ./env.local\n* npm run dev\n\nNavigate to http://localhost:3000 to access the frontend of this project.\n\n### DB-Setup\n\nAfter running `docker compose up`, perform the following steps:\n\n1. Open a new terminal window.\n2. Execute the command `docker exec -it db bash`.\n3. Run the command `psql -U postgres` to access the PostgreSQL command-line interface.\n4. Create a new database by executing the command `CREATE DATABASE blogx_db;`.\n5. Connect to the newly created database by executing the command `\\c blogx_db`.\n6. Open the `init.sql` file located in the `\\db` folder.\n7. Copy the contents of the `init.sql` file.\n8. Paste the copied contents into the terminal where the PostgreSQL command-line interface is running.\n9. Press Enter to execute the commands and initialize the database.\n\nBy following these steps, you should be able to set up the local environment and initialize the necessary database for the service.\n\n## Authentication service\n\n| endpoint  | method | success status\u003cbr /\u003ecode | auth token\u003cbr /\u003erequirement |\n| --------- | ------ | ------------------------ | --------------------------- |\n| /         | GET    | 200                      | NO                          |\n| /register | POST   | 201                      | NO                          |\n| /login    | POST   | 200                      | NO                          |\n| /logout   | POST   | 202                      | YES                         |\n\n---\n\n## Blog service\n\n| endpoint          | endpoint | success status\u003cbr /\u003ecode | auth token\u003cbr /\u003erequirement |\n| ----------------- | -------- | ------------------------ | --------------------------- |\n| /                 | GET      | 200                      | NO                          |\n| /addBlog          | POST     | 200                      | YES                         |\n| /updateBlog       | PATCH    | 200                      | YES                         |\n| /deleteBlog       | DELETE   | 204                      | YES                         |\n| /like?post_id=    | GET      | 200                      | YES                         |\n| /dislike?post_id= | GET      | 200                      | YES                         |\n\n---\n\n## Feed service\n\n| endpoint                   | method | success status\u003cbr /\u003ecode | auth token\u003cbr /\u003erequirement |\n| -------------------------- | ------ | ------------------------ | --------------------------- |\n| /                          | GET    | 200                      | NO                          |\n| /allPosts                  | GET    | 200                      | YES                         |\n| /allPostsPageWise?page_no= | GET    | 200                      | YES                         |\n| /postWithId?post_id=       | GET    | 200                      | YES                         |\n| /postWithUserId?user_id=   | GET    | 200                      | YES                         |\n| /myPosts                   | GET    | 200                      | YES                         |\n| /followingUsersPosts       | GET    | 200                      | YES                         |\n| /myLikedPosts              | GET    | 200                      | YES                         |\n\n---\n\n## User service\n\n| endpoint                | method | success status\u003cbr /\u003ecode | auth token\u003cbr /\u003erequirement |\n| ----------------------- | ------ | ------------------------ | --------------------------- |\n| /                       | GET    | 200                      | NO                          |\n| /delete                 | DELETE | 204                      | YES                         |\n| /follow?toFollowId=     | POST   | 200                      | YES                         |\n| /unfollow?toUnfollowId= | POST   | 200                      | YES                         |\n\n---\n\n\u003e As this is the first version of this backend, each service endpoint is preceded by `/v1/api`\n\n---\n\n## Database\n\nDatabase used - PostgreSQL\n\n### Schema\n\n![image](https://github.com/SohamRatnaparkhi/blogx-backend-go/assets/92905626/8cda3809-23ab-498a-a9ac-4572638d9cfd)\n[Database-diagram](https://drawsql.app/teams/soham-ratnaparkhi/diagrams/blog-app)\n\n## Description\n\n| Table name     | Description                                                                                           |\n| -------------- | ----------------------------------------------------------------------------------------------------- |\n| users          | Stores the details of users. The password is not stored directly; it is hashed for security purposes. |\n| posts          | Stores the blog posts created by users.                                                               |\n| user_followers | Represents the relationship between users, where the `follower_id` follows the `following_id`.    |\n| user_likes     | Records the likes given by users (user_id) to specific posts (post_id).                               |\n\n## Tools and Technologies used\n\n1. Go\n2. Next.js (Type-script)\n3. PostgreSQL\n4. Redis\n5. Docker and Docker-compose\n6. HAProxy (load-balancer)\n7. SwaggerUI\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohamratnaparkhi%2Fblogx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsohamratnaparkhi%2Fblogx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsohamratnaparkhi%2Fblogx/lists"}