{"id":30524912,"url":"https://github.com/brandaoplaster/foedus","last_synced_at":"2025-10-28T07:39:12.733Z","repository":{"id":310805138,"uuid":"1041293996","full_name":"brandaoplaster/foedus","owner":"brandaoplaster","description":null,"archived":false,"fork":false,"pushed_at":"2025-08-20T10:14:29.000Z","size":50,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-20T11:33:34.404Z","etag":null,"topics":["elixir","liveview"],"latest_commit_sha":null,"homepage":"","language":"Elixir","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/brandaoplaster.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}},"created_at":"2025-08-20T09:19:00.000Z","updated_at":"2025-08-20T09:21:57.000Z","dependencies_parsed_at":"2025-08-20T11:35:37.882Z","dependency_job_id":"4c9fefe4-9cea-4ca0-b6f4-4e5b2d5024fd","html_url":"https://github.com/brandaoplaster/foedus","commit_stats":null,"previous_names":["brandaoplaster/foedus"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/brandaoplaster/foedus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandaoplaster%2Ffoedus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandaoplaster%2Ffoedus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandaoplaster%2Ffoedus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandaoplaster%2Ffoedus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brandaoplaster","download_url":"https://codeload.github.com/brandaoplaster/foedus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brandaoplaster%2Ffoedus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":272255754,"owners_count":24901322,"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","status":"online","status_checked_at":"2025-08-26T02:00:07.904Z","response_time":60,"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":["elixir","liveview"],"created_at":"2025-08-26T21:02:45.380Z","updated_at":"2025-10-28T07:39:12.720Z","avatar_url":"https://github.com/brandaoplaster.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Foedus\n\nA modern contract management system built with Phoenix LiveView, designed to streamline contract creation, clause management, and client-company relationships.\n\n*Foedus* - from Latin meaning \"treaty\" or \"alliance\", perfectly embodying the essence of contract management and business agreements.\n\n## Features\n\n- **Contract Management**: Create, edit, and manage contracts with dynamic clause building\n- **Client \u0026 Company Management**: Maintain detailed records of clients and companies\n- **Real-time Interface**: Built with Phoenix LiveView for interactive user experience\n- **UUID-based IDs**: Uses binary IDs for enhanced security and scalability\n- **PostgreSQL Database**: Robust data storage with full ACID compliance\n\n## Tech Stack\n\n- **Phoenix Framework** - Web framework\n- **Phoenix LiveView** - Real-time, interactive web interface\n- **PostgreSQL** - Primary database\n- **Docker \u0026 Docker Compose** - Containerized development environment\n- **Elixir** - Programming language\n\n## Prerequisites\n\n- Docker and Docker Compose installed\n- Git\n\n## Getting Started\n\n### 1. Clone the Repository\n\n```bash\ngit clone \u003cyour-repository-url\u003e\ncd foedus\n```\n\n### 2. Environment Setup\n\nCreate a `.env` file in the project root:\n\n```bash\n# User permissions for file generation\nUSER_ID=$(id -u)\nGROUP_ID=$(id -g)\n\n# PostgreSQL Database Configuration\nPOSTGRES_USER=postgres\nPOSTGRES_PASSWORD=postgres\nPOSTGRES_DB=foedus_dev\nPOSTGRES_HOST=localhost\nPOSTGRES_PORT=5432\n\n# Phoenix Configuration\nSECRET_KEY_BASE=your_secret_key_base_here\nPHX_HOST=localhost\nPHX_PORT=4000\nDATABASE_URL=ecto://postgres:postgres@db:5432/foedus_dev\n\n```\n\n**Important**: Replace `your_secret_key_base_here` with a real secret key (see step 3).\n\n### 3. Generate Secret Key\n\nGenerate a secret key for the application:\n\n```bash\n# If you have Elixir installed locally\nmix phx.gen.secret\n\n# Or use OpenSSL\nopenssl rand -base64 64\n```\n\nUpdate the `SECRET_KEY_BASE` in the `.env` file with the generated key.\n\n### 4. Build and Start Services\n\n```bash\n# Build the application with proper user permissions\nexport USER_ID=$(id -u)\nexport GROUP_ID=$(id -g)\ndocker compose build\n\n# Start all services\ndocker compose up -d\n```\n\n### 5. Setup Database\n\n```bash\n# Create the database\ndocker compose run --rm app mix ecto.create\n\n# Run migrations (when you have them)\ndocker compose run --rm app mix ecto.migrate\n```\n\n### 6. Access the Application\n\nOpen your browser and navigate to: `http://localhost:4000`\n\n## Development Commands\n\n### Running Migrations\n\n```bash\n# Create a new migration\ndocker compose run --rm app mix ecto.gen.migration create_contracts\n\n# Run pending migrations\ndocker compose run --rm app mix ecto.migrate\n\n# Rollback last migration\ndocker compose run --rm app mix ecto.rollback\n```\n\n### Code Quality \u0026 Linting\n\n```bash\n# Run Credo for code analysis\ndocker compose run --rm app mix credo\n\n# Run Credo with strict mode (more detailed analysis)\ndocker compose run --rm app mix credo --strict\n```\n\n### Database Priming\n\n```bash\n# Run default\ndocker compose run --rm app mix db.prime\n\n# Clean database\ndocker compose run --rm app mix db.prime --clean\n\n# Run prime with flags\ndocker compose run --rm app mix db.prime --users 5 --contractors 3 --templates 2\n```\n\n### Generating Phoenix Resources\n\n```bash\n# Generate a LiveView resource\ndocker compose run --rm app mix phx.gen.live Contracts Contract contracts title:string content:text status:string client_id:binary_id company_id:binary_id\n\n# Generate a schema only\ndocker compose run --rm app mix phx.gen.schema Client clients name:string email:string phone:string\n```\n\n### Managing Dependencies\n\n```bash\n# Install new dependencies\ndocker compose run --rm app mix deps.get\n\n# Update dependencies\ndocker compose run --rm app mix deps.update --all\n```\n\n### Database Operations\n\n```bash\n# Reset database (drop, create, migrate)\ndocker compose run --rm app mix ecto.reset\n\n# Drop database\ndocker compose run --rm app mix ecto.drop\n\n# Check migration status\ndocker compose run --rm app mix ecto.migrations\n```\n\n## Docker Services\n\nThe application runs with the following services:\n\n- **app**: Phoenix application (port 4000)\n- **db**: PostgreSQL database (port 5432)\n- **redis**: Redis cache (port 6379) - Optional\n\n### Useful Docker Commands\n\n```bash\n# View application logs\ndocker compose logs -f app\n\n# View all service logs\ndocker compose logs -f\n\n# Access application shell\ndocker compose exec app sh\n\n# Access PostgreSQL\ndocker compose exec db psql -U postgres -d foedus_dev\n\n# Stop all services\ndocker compose down\n\n# Stop and remove volumes\ndocker compose down -v\n\n# Rebuild services\ndocker compose up --build\n```\n\n## Project Structure\n\n```\nfoedus/\n├── assets/          # Static assets (CSS, JS)\n├── config/          # Application configuration\n├── lib/\n│   ├── foedus/      # Business logic and contexts\n│   └── foedus_web/  # Web-related code (controllers, views, etc.)\n├── priv/\n│   └── repo/        # Database migrations and seeds\n├── test/            # Test files\n├── docker compose.yml\n├── Dockerfile\n└── mix.exs          # Project dependencies and configuration\n```\n\n## Configuration\n\n### Database Configuration\n\nThe database connection is configured in `config/dev.exs`. For Docker environment, the connection string is set via environment variables in `docker compose.yml`.\n\n### Environment Variables\n\nKey environment variables used:\n\n- `DATABASE_URL`: PostgreSQL connection string\n- `SECRET_KEY_BASE`: Secret key for sessions and cookies\n- `PHX_HOST`: Phoenix host (default: localhost)\n- `PHX_PORT`: Phoenix port (default: 4000)\n\n## File Permissions\n\nThe Docker setup is configured to use your host user ID to prevent permission issues when generating files. If you encounter permission problems:\n\n```bash\n# Fix file permissions\nsudo chown -R $USER:$USER .\n```\n\n## Troubleshooting\n\n### Database Connection Issues\n\n1. Ensure PostgreSQL service is running:\n   ```bash\n   docker compose ps db\n   ```\n\n2. Check database logs:\n   ```bash\n   docker compose logs db\n   ```\n\n### Application Won't Start\n\n1. Check application logs:\n   ```bash\n   docker compose logs app\n   ```\n\n2. Verify dependencies are installed:\n   ```bash\n   docker compose run --rm app mix deps.get\n   ```\n\n### Permission Issues\n\n1. Rebuild with correct user permissions:\n   ```bash\n   export USER_ID=$(id -u)\n   export GROUP_ID=$(id -g)\n   docker compose build --no-cache\n   ```\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandaoplaster%2Ffoedus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrandaoplaster%2Ffoedus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrandaoplaster%2Ffoedus/lists"}