{"id":20288560,"url":"https://github.com/ashiishme/ecometer","last_synced_at":"2025-06-20T20:38:52.615Z","repository":{"id":237431635,"uuid":"629112091","full_name":"ashiishme/ecometer","owner":"ashiishme","description":null,"archived":false,"fork":false,"pushed_at":"2023-04-19T09:32:47.000Z","size":78,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-04T04:27:34.026Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/ashiishme.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-04-17T16:36:56.000Z","updated_at":"2023-04-18T21:20:16.000Z","dependencies_parsed_at":"2024-05-01T18:45:10.417Z","dependency_job_id":"4c8595ae-0df2-4463-97ee-57532d0ec13c","html_url":"https://github.com/ashiishme/ecometer","commit_stats":null,"previous_names":["ashiishme/ecometer"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ashiishme/ecometer","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashiishme%2Fecometer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashiishme%2Fecometer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashiishme%2Fecometer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashiishme%2Fecometer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ashiishme","download_url":"https://codeload.github.com/ashiishme/ecometer/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ashiishme%2Fecometer/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261013677,"owners_count":23097091,"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":[],"created_at":"2024-11-14T14:48:15.684Z","updated_at":"2025-06-20T20:38:47.588Z","avatar_url":"https://github.com/ashiishme.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\u003ch1 align=\"center\" style=\"border: 0;\"\u003e Ecometer \u003c/h1\u003e\n\u003cp\u003eCollect energy data from user to calculate energy consumption\u003c/p\u003e\n\u003c/div\u003e\n\n# Project Structure\n\nThe application includes the backend of the application in below structure:\n\n```bash\n├── src\n├── docker-compose.yml\n...\n..\n```\n\nInside the `src` there is a `forms` directory used for defining the form structure by hardcoding the fields.\n\n# Running The Application\n\nPlease make sure you have the env file ready, you can find the sample in `server/.env.dist`.\n\nAs everything is dockerized, run the below docker command and the application will be ready to use:\n\n```bash\ndocker compose up\n```\n\nThe backend server: http://localhost:8080\n\n# Unit Tests\n\n```bash\nyarn test\n```\n\n# API Endpoints\n\nThere are in total 2 endpoints available and are exposed as follows:\n\n| Method | Path                             | Description                                                         |\n| ------ | -------------------------------- | ------------------------------------------------------------------- |\n| `GET`  | `/api/v1/forms/:formName`        | Gets the form structure of the given form                           |\n| `POST` | `/api/v1/forms/:formName/submit` | Creates user and energy reading data on database for the given form |\n\n`GET /api/v1/forms/:formName`\n\nFetches the form structure of `formName`.\n\n```\ncurl --request GET \\\n--url \"http://localhost:8080/api/v1/forms/{my-form-name}\"\n```\n\n`POST /api/v1/forms/:formName/submit`\n\nCreates the data of user and energy reading\n\n```\ncurl --request POST \\\n--url \"http://localhost:8080/api/v1/forms/{my-form-name}/submit\" \\\n--data '{\n    \"energyInfo\": {\n        \"buildingType\": \"residential\",\n        \"numberOfResidential\": 1,\n        \"serialNumber\": \"123A1B2C\",\n        \"type\": \"electricity\",\n        \"reading\": 6531231,\n        \"city\": \"Berlin\",\n        \"zip\": \"12345\",\n        \"termsAndConditions\": true\n    },\n    \"user\": {\n        \"firstName\": \"Ashish\",\n        \"lastName\": \"Yadav\",\n        \"phoneNumber\": \"21435657\",\n        \"email\": \"example@gmail.com\"\n    }\n}'\n```\n\nPlease check the `forms` directory for the example form that can be used for the API request.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashiishme%2Fecometer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fashiishme%2Fecometer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fashiishme%2Fecometer/lists"}