{"id":28945337,"url":"https://github.com/np5555/gramxbe","last_synced_at":"2025-10-30T02:07:44.337Z","repository":{"id":279573582,"uuid":"939249156","full_name":"NP5555/gramXbe","owner":"NP5555","description":"RESTful API built with Node.js and Express.js to support a token sale platform. It manages users, token batches, leaderboard rankings, and tasks for earning rewards. The API integrates with a mobile frontend application.","archived":false,"fork":false,"pushed_at":"2025-02-26T18:08:24.000Z","size":25,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-01T14:36:11.415Z","etag":null,"topics":["backend","dapp","dapps-development","development","mobile-app","token"],"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/NP5555.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-02-26T08:36:47.000Z","updated_at":"2025-04-16T10:16:30.000Z","dependencies_parsed_at":"2025-02-26T09:35:19.767Z","dependency_job_id":"1d421acb-82d7-4bd9-83f8-6e2d90e0ece1","html_url":"https://github.com/NP5555/gramXbe","commit_stats":null,"previous_names":["np5555/gramx-be"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/NP5555/gramXbe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NP5555%2FgramXbe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NP5555%2FgramXbe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NP5555%2FgramXbe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NP5555%2FgramXbe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NP5555","download_url":"https://codeload.github.com/NP5555/gramXbe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NP5555%2FgramXbe/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261434234,"owners_count":23157211,"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","dapp","dapps-development","development","mobile-app","token"],"created_at":"2025-06-23T07:11:41.418Z","updated_at":"2025-10-30T02:07:44.331Z","avatar_url":"https://github.com/NP5555.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GRAMXRO App Backend\n\n## Overview\nThis backend is a RESTful API built with Node.js and Express.js to support a token sale platform. It manages users, token batches, leaderboard rankings, and tasks for earning rewards. The API integrates with a mobile frontend application running on `http://localhost:8081`.\n\n## Features\n- **User Management**: Retrieve user details and balances.\n- **Token Sale**: View and purchase tokens from available batches.\n- **Leaderboard**: Track top users based on tokens and shares.\n- **Task System**: Earn tokens by completing predefined tasks.\n\n## Project Structure\n- **Server File**: `server.js` (contains all backend logic).\n- **Dependencies**:\n  - `express`: Web framework for Node.js.\n  - `cors`: Middleware for handling CORS requests.\n- **Dummy Data**:\n  - Users\n  - Token Batches\n  - Leaderboard\n  - Tasks\n\n## Installation\n1. **Clone the Repository**:\n   ```bash\n   git clone \u003crepository-url\u003e\n   cd \u003crepository-directory\u003e\n   ```\n2. **Install Dependencies**:\n   ```bash\n   npm install express cors\n   ```\n3. **Run the Server**:\n   ```bash\n   node server.js\n   ```\n   - The server runs on `http://localhost:3001`.\n\n## API Endpoints\n\n### 1. Get User by ID\n- **Endpoint**: `GET /user/:id`\n- **Response**:\n  - **200**: `{ id, name, referralCode, tokens, shares, profileImage }`\n  - **404**: `{ message: \"User not found\" }`\n\n### 2. Get Current Token Batch\n- **Endpoint**: `GET /batch/current`\n- **Response**:\n  - **200**: `{ batchNumber, currentPrice, nextPrice, tokensSold, totalTokens }`\n\n### 3. Get Leaderboard\n- **Endpoint**: `GET /leaderboard`\n- **Response**:\n  - **200**: `[ { userId, name, coins, shares }, ... ]`\n\n### 4. Purchase Tokens\n- **Endpoint**: `POST /tokens/purchase`\n- **Request Body**:\n  ```json\n  { \"userId\": 1, \"amount\": 100 }\n  ```\n- **Response**:\n  - **200**: `{ success: true, newBalance: number }`\n  - **400**: `{ message: \"Invalid purchase\" }`\n\n### 5. Complete Task\n- **Endpoint**: `POST /tasks/complete`\n- **Request Body**:\n  ```json\n  { \"userId\": 1, \"task\": \"Join Our Telegram Community\" }\n  ```\n- **Response**:\n  - **200**: `{ success: true, newBalance: number }`\n  - **400**: `{ message: \"Invalid task or user\" }`\n\n## Configuration\n- **Port**: `3001`\n- **CORS**: Allows requests from `http://localhost:8081`\n\n## Usage with Frontend\nThe backend integrates with a mobile frontend (built with Expo, React Native, and NativeWind). Screens include:\n- **Leaderboard** (`GET /leaderboard`)\n- **Earn More Coins** (`GET /tasks` and `POST /tasks/complete`)\n- **User Dashboard** (`GET /user/:id`)\n- **Token Purchase** (`GET /batch/current` and `POST /tokens/purchase`)\n\n## Development Notes\n- Basic logging and error handling included.\n- Replace dummy data with a database (e.g., MongoDB) for production.\n\n## Contributing\n1. Fork the repository.\n2. Make changes and add tests if applicable.\n3. Submit a pull request.\n\n## License\nThis project is licensed under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnp5555%2Fgramxbe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnp5555%2Fgramxbe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnp5555%2Fgramxbe/lists"}