{"id":46647143,"url":"https://github.com/jovialen/nokroner-backend","last_synced_at":"2026-03-08T05:03:51.799Z","repository":{"id":326875974,"uuid":"1076391965","full_name":"jovialen/nokroner-backend","owner":"jovialen","description":"Backend of the Nokroner personal finance app.","archived":false,"fork":false,"pushed_at":"2026-01-30T07:55:41.000Z","size":201,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-30T22:40:54.036Z","etag":null,"topics":["backend","personal-finance","postgresql","rest-api","ruby-on-rails-8","ruby-on-rails-api"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jovialen.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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-10-14T19:46:36.000Z","updated_at":"2026-01-30T07:54:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"49a62479-b5b8-400f-8643-da96501d4144","html_url":"https://github.com/jovialen/nokroner-backend","commit_stats":null,"previous_names":["jovialen/nokroner-backend"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/jovialen/nokroner-backend","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jovialen%2Fnokroner-backend","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jovialen%2Fnokroner-backend/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jovialen%2Fnokroner-backend/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jovialen%2Fnokroner-backend/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jovialen","download_url":"https://codeload.github.com/jovialen/nokroner-backend/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jovialen%2Fnokroner-backend/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30246626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-08T00:58:18.660Z","status":"online","status_checked_at":"2026-03-08T02:00:06.215Z","response_time":56,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["backend","personal-finance","postgresql","rest-api","ruby-on-rails-8","ruby-on-rails-api"],"created_at":"2026-03-08T05:03:50.880Z","updated_at":"2026-03-08T05:03:51.775Z","avatar_url":"https://github.com/jovialen.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Nokroner Backend\n\n[![CI](https://github.com/jovialen/nokroner-backend/actions/workflows/ci.yml/badge.svg)](https://github.com/jovialen/nokroner-backend/actions/workflows/ci.yml)\n[![Ruby Style Guide](https://img.shields.io/badge/code_style-rubocop-brightgreen.svg)](https://github.com/rubocop/rubocop)\n[![Rails](https://img.shields.io/badge/Rails-8.1.2-red.svg)](https://rubyonrails.org/)\n[![License](https://img.shields.io/badge/license-GPLv3-blue.svg)](LICENSE)\n\nA personal finance management API built with Ruby on Rails. Track accounts, transactions, and manage your finances with ease.\n\n## Features\n\n- 🔐 **User Authentication** - Secure session-based and token-based authentication\n- 👤 **User Profiles** - Manage personal information and preferences\n- 💼 **Multi-Owner Support** - Create and manage multiple financial entities\n- 🏦 **Account Management** - Track multiple bank accounts per owner\n- 💸 **Transaction Tracking** - Record income, expenses, and transfers\n- 📊 **Transaction Categorization** - Internal vs external transactions\n- 🔍 **Advanced Querying** - Filter transactions by date, account, and type\n- 📖 **API Documentation** - Auto-generated OpenAPI documentation\n\n## Technology Stack\n\n- **Framework**: Ruby on Rails 8.1.2\n- **Database**: PostgreSQL\n- **Authentication**: BCrypt with has_secure_password\n- **API Documentation**: OasRails (OpenAPI/Swagger)\n- **Testing**: Minitest\n- **Deployment**: Kamal with Docker\n- **Job Queue**: Solid Queue\n- **Cable**: Solid Cable\n- **Cache**: Solid Cache\n\n## Getting Started\n\n### Prerequisites\n\n- Ruby 3.4+ (or the version specified in `.ruby-version`)\n- PostgreSQL\n- Bundler\n\n### Installation\n\n1. Clone the repository:\n```bash\ngit clone https://github.com/jovialen/nokroner-backend.git\ncd nokroner-backend\n```\n\n2. Install dependencies:\n```bash\nbundle install\n```\n\n3. Set up the database:\n```bash\nbin/rails db:create\nbin/rails db:migrate\n```\n\n4. Start the server:\n```bash\nbin/rails server\n```\n\nThe application will be available at `http://localhost:3000`.\n\n### Running Tests\n\nRun the full test suite:\n```bash\nbin/rails test\n```\n\nRun specific test files:\n```bash\nbin/rails test test/controllers/api/v1/user_controller_test.rb\n```\n\n### Code Quality\n\nRun RuboCop for style checking:\n```bash\nbin/rubocop\n```\n\nRun Brakeman for security analysis:\n```bash\nbin/brakeman\n```\n\nRun Bundler Audit for dependency security:\n```bash\nbin/bundler-audit\n```\n\nRun all CI checks:\n```bash\nbin/ci\n```\n\n## API Documentation\n\nInteractive API documentation is available at `/docs` when the server is running.\n\nVisit `http://localhost:3000/docs` to explore the API endpoints.\n\n## API Overview\n\n### Authentication\n\nThe API supports two authentication methods:\n\n1. **Bearer Token**: Include the token in the Authorization header\n   ```\n   Authorization: Bearer \u003cyour_token\u003e\n   ```\n\n2. **Encrypted Cookie**: Automatically set when logging in through the web interface\n\n### Main Endpoints\n\n#### User Management\n- `POST /api/v1/register` - Create a new user account\n- `POST /api/v1/login` - Authenticate and get session token\n- `DELETE /api/v1/logout` - End current session\n- `GET /api/v1/me` - Get current user information\n- `DELETE /api/v1/me` - Delete user account\n\n#### Profile\n- `GET /api/v1/me/profile` - Get user profile\n- `PATCH /api/v1/me/profile` - Update user profile\n\n#### Owners\n- `GET /api/v1/owners` - List all owners\n- `POST /api/v1/owners` - Create new owner\n- `GET /api/v1/owners/:id` - Get owner details\n- `PATCH /api/v1/owners/:id` - Update owner\n- `DELETE /api/v1/owners/:id` - Delete owner\n\n#### Accounts\n- `GET /api/v1/accounts` - List all accounts\n- `GET /api/v1/owners/:owner_id/accounts` - List accounts for specific owner\n- `POST /api/v1/accounts` - Create new account\n- `GET /api/v1/accounts/:id` - Get account details\n- `PATCH /api/v1/accounts/:id` - Update account\n- `DELETE /api/v1/accounts/:id` - Delete account\n\n#### Transactions\n- `GET /api/v1/transactions` - List all transactions\n- `POST /api/v1/transactions` - Create new transaction\n- `GET /api/v1/transactions/:id` - Get transaction details\n- `PATCH /api/v1/transactions/:id` - Update transaction\n- `DELETE /api/v1/transactions/:id` - Delete transaction\n\n## Database Schema\n\n### Core Models\n\n- **User**: User accounts with authentication\n- **Profile**: User profile information (name, date of birth)\n- **Session**: User authentication sessions\n- **Owner**: Financial entities (user can have multiple)\n- **Account**: Bank accounts belonging to owners\n- **Transaction**: Financial transactions between accounts\n\n### Key Relationships\n\n- Users have one Profile and one Owner (as themselves)\n- Users can create multiple additional Owners\n- Owners have multiple Accounts\n- Accounts have many sent and received Transactions\n- Transactions belong to a User (creator)\n\n## Transaction Logic\n\nTransactions automatically update account balances:\n\n- **Internal Transfer**: Between two accounts owned by same owner\n- **External Transfer**: Between accounts with different owners\n- **Income**: Money coming into an account (from_account is nil)\n- **Expense**: Money leaving an account (to_account is nil)\n\nAccount balances are automatically maintained through transaction callbacks.\n\n## Development\n\n### Environment Configuration\n\nConfigure your environment variables in `.env` or through your deployment system:\n\n- `POSTGRES_HOST` - PostgreSQL host (default: localhost)\n- `POSTGRES_PORT` - PostgreSQL port (default: 5432)\n- `POSTGRES_USER` - PostgreSQL username\n- `POSTGRES_PASSWORD` - PostgreSQL password\n- `RAILS_MASTER_KEY` - Rails master key for credentials\n\n### Database Setup\n\nThe application uses PostgreSQL with multiple databases in production:\n- Primary database for main data\n- Cache database for Rails cache\n- Queue database for job queue\n- Cable database for Action Cable\n\n## Deployment\n\nThe application is configured for deployment with Kamal:\n\n```bash\n# Setup deployment\nkamal setup\n\n# Deploy\nkamal deploy\n\n# View logs\nkamal logs -f\n```\n\nSee `config/deploy.yml` for deployment configuration.\n\n## Development\n\n### Code Style\n\n- Follow the Ruby style guide enforced by RuboCop\n- Write tests for new features\n- Ensure all tests pass before submitting PR\n- Keep test coverage high\n\n## Security\n\n- Passwords are hashed using BCrypt\n- Sessions use secure tokens\n- CORS is configured for cross-origin requests\n- API supports both cookie and bearer token authentication\n- Regular security audits with Brakeman and Bundler Audit\n\n## License\n\nThis project is licensed under the GNU General Public License version 3 - see the LICENSE file for details.\n\n## Contact\n\nNicolai Frigaard - nicofri@pm.me\n\nProject Link: [https://github.com/jovialen/nokroner-backend](https://github.com/jovialen/nokroner-backend)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjovialen%2Fnokroner-backend","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjovialen%2Fnokroner-backend","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjovialen%2Fnokroner-backend/lists"}