{"id":17708542,"url":"https://github.com/carrilloapps/simple-crud-api","last_synced_at":"2026-05-05T04:34:07.014Z","repository":{"id":148294935,"uuid":"619912916","full_name":"carrilloapps/simple-crud-api","owner":"carrilloapps","description":"Simple CRUD app with auth x-api-key + mongodb in Go","archived":false,"fork":false,"pushed_at":"2023-05-27T20:08:03.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-22T17:08:06.807Z","etag":null,"topics":["crud-api","docker","docker-compose","dockerfile","echo-framework","env","go","golang","mongodb","rest-api","x-api-key"],"latest_commit_sha":null,"homepage":"","language":"Go","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/carrilloapps.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-03-27T16:56:14.000Z","updated_at":"2024-11-14T21:17:23.000Z","dependencies_parsed_at":null,"dependency_job_id":"f3c697e5-a158-4781-bd36-70eb5809a533","html_url":"https://github.com/carrilloapps/simple-crud-api","commit_stats":null,"previous_names":["carrilloapps/simple-crud-api","juniorcarrillo/simple-crud-api"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/carrilloapps/simple-crud-api","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrilloapps%2Fsimple-crud-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrilloapps%2Fsimple-crud-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrilloapps%2Fsimple-crud-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrilloapps%2Fsimple-crud-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/carrilloapps","download_url":"https://codeload.github.com/carrilloapps/simple-crud-api/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/carrilloapps%2Fsimple-crud-api/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261330123,"owners_count":23142482,"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":["crud-api","docker","docker-compose","dockerfile","echo-framework","env","go","golang","mongodb","rest-api","x-api-key"],"created_at":"2024-10-25T02:07:35.099Z","updated_at":"2025-10-24T10:20:59.454Z","avatar_url":"https://github.com/carrilloapps.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SimpleCrudApi v1\n\n[![Go](https://github.com/JuniorCarrillo/simple-crud-api/workflows/Go/badge.svg)](https://github.com/JuniorCarrillo/simple-crud-api/actions?query=workflow:\"Go\")\n[![GitHub tag](https://img.shields.io/github/tag/JuniorCarrillo/simple-crud-api?include_prereleases=\u0026sort=semver\u0026color=blue)](https://github.com/JuniorCarrillo/simple-crud-api/releases/)\n[![Sourcegraph](https://sourcegraph.com/github.com/JuniorCarrillo/simple-crud-api/-/badge.svg?style=flat-square)](https://sourcegraph.com/github.com/JuniorCarrillo/simple-crud-api?badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/JuniorCarrillo/simple-crud-api?style=flat-square)](https://goreportcard.com/report/github.com/JuniorCarrillo/simple-crud-api)\n[![License](http://img.shields.io/badge/license-mit-blue.svg?style=flat-square)](https://raw.githubusercontent.com/JuniorCarrillo/simple-crud-api/master/LICENSE)\n[![JuniorCarrillo - simple-crud-api](https://img.shields.io/static/v1?label=JuniorCarrillo\u0026message=simple-crud-api\u0026color=blue\u0026logo=github)](https://github.com/JuniorCarrillo/simple-crud-api \"Go to GitHub repo\")\n[![stars - simple-crud-api](https://img.shields.io/github/stars/JuniorCarrillo/simple-crud-api?style=social)](https://github.com/JuniorCarrillo/simple-crud-api)\n[![forks - simple-crud-api](https://img.shields.io/github/forks/JuniorCarrillo/simple-crud-api?style=social)](https://github.com/JuniorCarrillo/simple-crud-api)\n[![OS - macOS](https://img.shields.io/badge/OS-macOS-blue?logo=apple\u0026logoColor=white)](https://www.apple.com/macos/ \"Go to Apple homepage\")\n[![OS - Linux](https://img.shields.io/badge/OS-Linux-blue?logo=linux\u0026logoColor=white)](https://www.linux.org/ \"Go to Linux homepage\")\n[![Made with Docker](https://img.shields.io/badge/Made_with-Docker-blue?logo=docker\u0026logoColor=white)](https://www.docker.com/ \"Go to Docker homepage\")\n[![Made with Go](https://img.shields.io/badge/Go-1-blue?logo=go\u0026logoColor=white)](https://golang.org \"Go to Go homepage\")\n[![Made with MongoDB](https://img.shields.io/badge/MongoDB-3-blue?logo=mongodb\u0026logoColor=white)](https://www.mongodb.com/ \"Go to MongoDB homepage\")\n\nThis is a Rest API for use as a Back End, which is developed in Go, using echo and can be connected to MongoDB. It is a simple platform, as an example for implementing CRUDs in Go with MongoDB.\n\nThis platform runs on port `:3000`, which can be modified in the environment variables of the `.env` file, for which an example is provided in `.env.example`.\n\n### Structure of the system\nHere is shown the organization and structural components, architecture, and specific organization of the repository.\n\n#### Files in the repository\nWithin this repository, there are a total of 24 files (including `.env`) and 9 directories. These are shown in the following structural map:\n```\n.\n├── Dockerfile\n├── Makefile\n├── README.md\n├── api\n│ ├── api.go\n│ ├── dtos\n│ │ ├── character.dto.go\n│ │ ├── response.dto.go\n│ │ └── team.dto.go\n│ ├── handlers\n│ │ ├── character.handler.go\n│ │ ├── healthCheck.handler.go\n│ │ └── team.handler.go\n│ ├── middlewares\n│ │ └── middlewares.go\n│ ├── models\n│ │ └── character.model.go\n│ ├── router\n│ │ └── router.go\n│ └── tools\n│     ├── calculatePages.go\n│     ├── capitalize.tool.go\n│     └── urlInCtx.tool.go\n├── database\n│ ├── characters.go\n│ └── db.go\n├── docker-compose.yml\n├── go.mod\n├── go.sum\n├── main.go\n└── server.go\n```\n\n#### System libraries\nThis platform was developed in `go 1.19` with a `modules` configuration, making use of the following components or libraries:\n\n```\nrequire (\n\tgithub.com/golang-jwt/jwt v3.2.2+incompatible // indirect\n\tgithub.com/golang/snappy v0.0.4 // indirect\n\tgithub.com/joho/godotenv v1.5.1 // indirect\n\tgithub.com/klauspost/compress v1.13.6 // indirect\n\tgithub.com/labstack/echo/v4 v4.10.2 // indirect\n\tgithub.com/labstack/gommon v0.4.0 // indirect\n\tgithub.com/mattn/go-colorable v0.1.13 // indirect\n\tgithub.com/mattn/go-isatty v0.0.17 // indirect\n\tgithub.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect\n\tgithub.com/pkg/errors v0.9.1 // indirect\n\tgithub.com/valyala/bytebufferpool v1.0.0 // indirect\n\tgithub.com/valyala/fasttemplate v1.2.2 // indirect\n\tgithub.com/xdg-go/pbkdf2 v1.0.0 // indirect\n\tgithub.com/xdg-go/scram v1.1.1 // indirect\n\tgithub.com/xdg-go/stringprep v1.0.3 // indirect\n\tgithub.com/youmark/pkcs8 v0.0.0-20201027041543-1326539a0a0a // indirect\n\tgo.mongodb.org/mongo-driver v1.11.3 // indirect\n\tgolang.org/x/crypto v0.6.0 // indirect\n\tgolang.org/x/net v0.7.0 // indirect\n\tgolang.org/x/sync v0.0.0-20210220032951-036812b2e83c // indirect\n\tgolang.org/x/sys v0.5.0 // indirect\n\tgolang.org/x/text v0.7.0 // indirect\n\tgolang.org/x/time v0.3.0 // indirect\n)\n```\n\n## Install\n\n1. Clone the repository\n```\ngit clone https://github.com/JuniorCarrillo/simple-crud-api.git\n```\n\n2. Install dependencies\n\n```\ncd simple-crud-api \u0026\u0026 make install-example # Or 'make install' if you have environment variables ready or an .env file already created \n```\n\n3. Run application\n\n```\nmake run-example\n```\n\n4. Running on port 3000\n\n```\ncurl http://localhost:3000/\n```\n\n## Install in docker container\n\n1. Pull image\n```\ndocker pull ghcr.io/juniorcarrillo/simple-crud-api:release\n```\n\n2. Run application\n```\ndocker run -dp 3000:3000 \\\n--name simple-crud-api \\\n-e MONGO_USERNAME=root \\\n-e MONGO_PASSWORD=123456 \\\n-e MONGO_HOST=localhost \\\n-e MONGO_PORT=27017 \\\n-e MONGO_COLLECTION=simple-crud-api \\\n-e X_API_KEY=es123456 \\\nsimple-crud-api\n```\n\n## Use\n\nHere, the available endpoints or routes within the REST service are listed. It should be noted that to use it, you must have the `x-api-key` header (available in the environment variables or the `.env` file) for the routes under the pattern `/api/v1/`, which have a security middleware.\n\n### POST /api/v1/team (Search in POST method)\n\nRequest example:\n```\ncurl --location 'http://localhost:3000/api/v1/team' \\\n--header 'x-api-key: es123456' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"name\": \"nombre\",\n    \"pages\": 1\n}'\n```\n\nResponse example:\n```\n{\n    \"info\": {\n        \"count\": 3,\n        \"pages\": 1,\n        \"next\": \"http://localhost:3000/api/v1/character?pages=2\u0026search=Nombre\",\n        \"prev\": \"\"\n    },\n    \"result\": [\n        {\n            \"_id\": \"6420ccb6d60daa54c8dfe778\",\n            \"name\": \"Nombre de ejemplo 1\",\n            \"created_at\": \"2023-03-26T22:52:38.603Z\",\n            \"updated_at\": \"2023-03-27T15:58:45.921Z\"\n        },\n        {\n            \"_id\": \"6420cccd8023772a74e6594e\",\n            \"name\": \"Nombre de ejemplo 5\",\n            \"created_at\": \"2023-03-26T22:53:01.093Z\"\n        },\n        {\n            \"_id\": \"6420d099ad315b1386be643d\",\n            \"name\": \"Nombre de ejemplo 5\",\n            \"created_at\": \"2023-03-26T23:09:13.986Z\"\n        }\n    ]\n}\n```\n\n### GET /api/v1/character (Search in GET method)\n\nRequest example:\n```\ncurl --location 'http://localhost:3000/api/v1/character?pages=1\u0026search=Nombre' \\\n--header 'x-api-key: es123456'\n```\n\nResponse example:\n```\n{\n    \"info\": {\n        \"count\": 3,\n        \"pages\": 1,\n        \"next\": \"http://localhost:3000/api/v1/character?pages=2\u0026search=Nombre\",\n        \"prev\": \"\"\n    },\n    \"result\": [\n        {\n            \"_id\": \"6420ccb6d60daa54c8dfe778\",\n            \"name\": \"Nombre de ejemplo 1\",\n            \"created_at\": \"2023-03-26T22:52:38.603Z\",\n            \"updated_at\": \"2023-03-27T15:58:45.921Z\"\n        },\n        {\n            \"_id\": \"6420cccd8023772a74e6594e\",\n            \"name\": \"Nombre de ejemplo 5\",\n            \"created_at\": \"2023-03-26T22:53:01.093Z\"\n        },\n        {\n            \"_id\": \"6420d099ad315b1386be643d\",\n            \"name\": \"Nombre de ejemplo 5\",\n            \"created_at\": \"2023-03-26T23:09:13.986Z\"\n        }\n    ]\n}\n```\n\n### POST /api/v1/character (Create new character)\n\nRequest example:\n```\ncurl --location 'http://localhost:3000/api/v1/character' \\\n--header 'x-api-key: es123456' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"name\": \"Joe\",\n    \"genre\": \"Male\"\n}'\n```\n\nResponse example:\n```\n{\n    \"message\": \"Item saved with id '6421e522bb8c68d830a53eab'.\",\n    \"character\": {\n        \"_id\": \"6421e522bb8c68d830a53eab\",\n        \"name\": \"Joe\",\n        \"created_at\": \"2023-03-27T13:49:06.472259-05:00\"\n    }\n}\n```\n\n### GET /api/v1/character/:id (Get character by id)\n\nRequest example:\n```\ncurl --location 'http://localhost:3000/api/v1/character/6421e522bb8c68d830a53eab' \\\n--header 'x-api-key: es123456'\n```\n\nResponse example:\n```\n{\n    \"message\": \"Item found for id '6421e522bb8c68d830a53eab'.\",\n    \"character\": {\n        \"_id\": \"6421e522bb8c68d830a53eab\",\n        \"name\": \"Joe\",\n        \"created_at\": \"2023-03-27T18:49:06.472Z\"\n    }\n}\n```\n\n### PUT /api/v1/character/:id (Update character by id)\n\nRequest example:\n```\ncurl --location --request PUT 'http://localhost:3000/api/v1/character/6421e522bb8c68d830a53eab' \\\n--header 'x-api-key: es123456' \\\n--header 'Content-Type: application/json' \\\n--data '{\n    \"type\": \"Human\"\n}'\n```\n\nResponse example:\n```\n{\n    \"message\": \"The element with the id '6421e522bb8c68d830a53eab' has been updated successfully.\"\n}\n```\n\n### DELETE /api/v1/character/:id (Delete character by id)\n\nRequest example:\n```\ncurl --location --request DELETE 'http://localhost:3000/api/v1/character/6421e522bb8c68d830a53eab' \\\n--header 'x-api-key: es123456'\n```\n\nResponse example:\n```\n{\n    \"message\": \"The element with the id '6421e522bb8c68d830a53eab' has been deleted successfully.\"\n}\n```\n\n## Contribution\n\nIf you want to contribute to this project, please follow these steps:\n\n1. Fork the repository\n2. Create a branch (`git checkout -b feature/new-feature`)\n3. Make the necessary changes and commit (`git commit -am 'Add new feature'`)\n4. Push to the branch (`git push origin feature/new-feature`)\n5. Open a pull request\n\n## License\n\n[MIT License](https://github.com/JuniorCarrillo/simple-crud-api/blob/master/LICENSE) © Junior Carrillo\n\n### Contact us\n- [Email](mailto:soyjrcarrillo@gmail.com)\n- [WhatsApp](https://wa.me/+573003328389)\n- [Telegram](https://t.me/juniorcarrillo)\n- [Facebook](https://fb.com/soyjrcarrillo)\n- [Twitter](https://twitter.com/soyjrcarrillo)\n- [Instagram](https://instagram.com/soyjrcarrillo)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarrilloapps%2Fsimple-crud-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcarrilloapps%2Fsimple-crud-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcarrilloapps%2Fsimple-crud-api/lists"}