{"id":49319957,"url":"https://github.com/codegoalie/random-motivation","last_synced_at":"2026-04-26T17:02:55.268Z","repository":{"id":331091188,"uuid":"1090674989","full_name":"codegoalie/random-motivation","owner":"codegoalie","description":"A server to serve a random quote","archived":false,"fork":false,"pushed_at":"2025-12-30T15:00:15.000Z","size":27,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-03T01:20:03.996Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/codegoalie.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-11-06T01:40:15.000Z","updated_at":"2025-12-30T11:03:26.000Z","dependencies_parsed_at":"2026-01-03T11:06:24.532Z","dependency_job_id":null,"html_url":"https://github.com/codegoalie/random-motivation","commit_stats":null,"previous_names":["codegoalie/random-motivation"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/codegoalie/random-motivation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegoalie%2Frandom-motivation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegoalie%2Frandom-motivation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegoalie%2Frandom-motivation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegoalie%2Frandom-motivation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/codegoalie","download_url":"https://codeload.github.com/codegoalie/random-motivation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/codegoalie%2Frandom-motivation/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32305043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-26T09:34:17.070Z","status":"ssl_error","status_checked_at":"2026-04-26T09:34:00.993Z","response_time":129,"last_error":"SSL_read: 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":[],"created_at":"2026-04-26T17:02:54.188Z","updated_at":"2026-04-26T17:02:55.257Z","avatar_url":"https://github.com/codegoalie.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Random Motivation API\n\nA simple REST API that serves random motivational quotes. Built with Go, Echo framework, and SQLite.\n\n## Features\n\n- Get random motivational quotes\n- Add new motivational quotes\n- Persistent storage with SQLite\n- Automatic migration from text file to database\n\n## Quick Start\n\n```bash\n# Build the application\ngo build -o motivation\n\n# Run the server\n./motivation\n```\n\nThe server will start on `http://localhost:8080`\n\n## API Endpoints\n\n### Get Random Motivation\n\n```bash\ncurl http://localhost:8080/motivation\n```\n\n**Response:** A random motivational quote as plain text\n\n**Status Codes:**\n- `200 OK` - Success\n- `404 Not Found` - No motivations in database\n- `500 Internal Server Error` - Database error\n\n### Add New Motivation\n\n```bash\ncurl -X POST -d \"Your motivational quote here\" http://localhost:8080/motivation\n```\n\n**Response:** `Motivation added successfully`\n\n**Status Codes:**\n- `201 Created` - Successfully added\n- `400 Bad Request` - Empty motivation\n- `500 Internal Server Error` - Database error\n\n## Configuration\n\nEnvironment variables:\n\n- `DB_PATH` - Database file path (default: `./motivations.db`)\n\nExample:\n```bash\nDB_PATH=/var/data/motivations.db ./motivation\n```\n\n## Data Migration\n\nOn first run, if `motivations.txt` exists, the application will:\n1. Migrate all quotes to the SQLite database\n2. Back up the original file as `motivations.txt.backup`\n\nThis migration only happens once when the database is empty.\n\n## Database\n\nThe application uses SQLite with the following schema:\n\n```sql\nCREATE TABLE motivations (\n    id INTEGER PRIMARY KEY AUTOINCREMENT,\n    text TEXT NOT NULL,\n    created_at DATETIME DEFAULT CURRENT_TIMESTAMP\n);\n```\n\nYou can query the database directly:\n\n```bash\nsqlite3 motivations.db \"SELECT * FROM motivations;\"\n```\n\n## Development\n\n```bash\n# Install dependencies\ngo mod download\n\n# Run without building\ngo run main.go\n\n# Run tests\ngo test ./...\n\n# Format code\ngo fmt ./...\n```\n\n## Project Structure\n\n```\n.\n├── main.go              # HTTP server and handlers\n├── db/                  # Database package\n│   ├── db.go           # Connection management\n│   ├── migrations.go   # Schema definitions\n│   ├── repository.go   # CRUD operations\n│   └── migrate_text.go # Text file migration\n└── motivations.db      # SQLite database (generated)\n```\n\n## Dependencies\n\n- [Echo v4](https://echo.labstack.com/) - High performance Go web framework\n- [modernc.org/sqlite](https://gitlab.com/cznic/sqlite) - Pure Go SQLite driver\n\n## License\n\nThis project is open source and available under the MIT License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodegoalie%2Frandom-motivation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcodegoalie%2Frandom-motivation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcodegoalie%2Frandom-motivation/lists"}