base on Contractor payments # Flexile
Contractor payments.
## Setup
You'll need:
- [Docker](https://docs.docker.com/engine/install/)
- [Node.js](https://nodejs.org/en/download) (see [`.node-version`](.node-version))
- [Ruby](https://www.ruby-lang.org/en/documentation/installation/)
The easiest way to set up the development environment is to use the [`bin/setup` script](bin/setup), but feel free to run the commands in it yourself:
### Backend
- Set up Ruby (ideally using `rbenv`/`rvm`) and PostgreSQL
- Navigate to backend code and install dependencies: `cd backend && bundle i && gem install foreman`
### Frontend
- Navigate to frontend app and install dependencies `cd frontend && pnpm i`
Finally, set up your environment: `cp .env.example .env`. If you're an Antiwork team member, you can use `vercel env pull .env`.
## Running the App
You can start the local app using the [`bin/dev` script](bin/dev) - or feel free to run the commands contained in it yourself.
Once the local services are up and running, the application will be available at http://localhost:3000, with the backend (Rails API) running at http://localhost:3001.
**Development shortcuts**:
- If `ENABLE_DEFAULT_OTP=true` is set in your `.env`, you can use `000000` as the OTP for logging in or signing up.
- Use these pre-seeded accounts (password: `password` for all):
- **Admin**: `
[email protected]` (Primary Administrator)
- **Contractor**: `
[email protected]` (Software Engineer)
- **Investor**: `
[email protected]` (Investor)
- **More accounts**: See [the seed data](backend/config/data/seed_templates/gumroad.json) for additional test users (emails are always
[email protected])
## Common Issues / Debugging
### 1. Postgres User Creation
**Issue:** When running `bin/dev` (after `bin/setup`) encountered `FATAL: role "username" does not exist`
**Resolution:** Manually create the Postgres user with:
```
psql postgres -c "CREATE USER username WITH LOGIN CREATEDB SUPERUSER PASSWORD 'password';"
```
Likely caused by the `bin/setup` script failing silently due to lack of Postgres superuser permissions (common with Homebrew installations).
### 2. Redis Connection & database seeding
**Issue:** First attempt to run `bin/dev` failed with `Redis::CannotConnectError` on port 6389.
**Resolution:** Re-running `bin/dev` resolved it but data wasn't seeded properly, so had to run `db:reset`
Likely caused by rails attempting to connect before Redis had fully started.
### 3. Stripe-related rspec/playwright tests fail
**Issue:** Tests that involve Stripe operations may fail due to invalid or missing customer IDs.
**Resolution:**
1. Generate real customer id, simplest way to do it:
```bash
stripe customers create \
--name "Customer Name" \
--email "
[email protected]" \
--api-key "sk_test_mock"
```
2. Update company factories (on frontend and backend) with that customer id
## Testing
```shell
# Run Rails specs
bundle exec rspec
# Run a single spec
bundle exec rspec spec/system/roles/show_spec.rb:7
# Run Playwright end-to-end tests
pnpm playwright test
```
## Services configuration
<details>
<summary>Stripe</summary>
1. Create account at [stripe.com](https://stripe.com) and complete verification
2. Enable **Test mode** (toggle in top right of dashboard)
3. Navigate to **Developers** → **API keys**
4. Copy **Publishable key** (`pk_test_...`) and **Secret key** (`sk_test_...` - click "Reveal" first)
5. Add to `.env`:
```
NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY=pk_test_your_publishable_key_here
STRIPE_SECRET_KEY=sk_test_your_secret_key_here
```
</details>
<details>
<summary>Wise</summary>
1. Register at [sandbox.transferwise.tech](https://sandbox.transferwise.tech/) and complete email verification
2. Click profile/avatar → **Settings** → copy your **Membership number**
3. Go to **Integrations and Tools** → **API tokens** → **Create API token**
4. Set permissions to **Full Access**, name it (e.g., "Flexile Development"), and copy the token immediately
5. Add to `.env`:
```
WISE_PROFILE_ID=12345678 # Should be a number
WISE_API_KEY=your_full_api_token_here
```
</details>
<details>
<summary>Resend</summary>
1. Create account at [resend.com](https://resend.com) and complete email verification
2. Navigate to **API Keys** in the dashboard
3. Click **Create API Key**, give it a name (e.g., "Flexile Development")
4. Copy the API key immediately (starts with re\_)
5. Add to `.env`:
```
RESEND_API_KEY=re_your_api_key_here
```
</details>
**Note**: Keep credentials secure and never commit to version control.
## License
Flexile is licensed under the [MIT License](LICENSE.md).
", Assign "at most 3 tags" to the expected json: {"id":"14238","tags":[]} "only from the tags list I provide: [{"id":77,"name":"3d"},{"id":89,"name":"agent"},{"id":17,"name":"ai"},{"id":54,"name":"algorithm"},{"id":24,"name":"api"},{"id":44,"name":"authentication"},{"id":3,"name":"aws"},{"id":27,"name":"backend"},{"id":60,"name":"benchmark"},{"id":72,"name":"best-practices"},{"id":39,"name":"bitcoin"},{"id":37,"name":"blockchain"},{"id":1,"name":"blog"},{"id":45,"name":"bundler"},{"id":58,"name":"cache"},{"id":21,"name":"chat"},{"id":49,"name":"cicd"},{"id":4,"name":"cli"},{"id":64,"name":"cloud-native"},{"id":48,"name":"cms"},{"id":61,"name":"compiler"},{"id":68,"name":"containerization"},{"id":92,"name":"crm"},{"id":34,"name":"data"},{"id":47,"name":"database"},{"id":8,"name":"declarative-gui "},{"id":9,"name":"deploy-tool"},{"id":53,"name":"desktop-app"},{"id":6,"name":"dev-exp-lib"},{"id":59,"name":"dev-tool"},{"id":13,"name":"ecommerce"},{"id":26,"name":"editor"},{"id":66,"name":"emulator"},{"id":62,"name":"filesystem"},{"id":80,"name":"finance"},{"id":15,"name":"firmware"},{"id":73,"name":"for-fun"},{"id":2,"name":"framework"},{"id":11,"name":"frontend"},{"id":22,"name":"game"},{"id":81,"name":"game-engine "},{"id":23,"name":"graphql"},{"id":84,"name":"gui"},{"id":91,"name":"http"},{"id":5,"name":"http-client"},{"id":51,"name":"iac"},{"id":30,"name":"ide"},{"id":78,"name":"iot"},{"id":40,"name":"json"},{"id":83,"name":"julian"},{"id":38,"name":"k8s"},{"id":31,"name":"language"},{"id":10,"name":"learning-resource"},{"id":33,"name":"lib"},{"id":41,"name":"linter"},{"id":28,"name":"lms"},{"id":16,"name":"logging"},{"id":76,"name":"low-code"},{"id":90,"name":"message-queue"},{"id":42,"name":"mobile-app"},{"id":18,"name":"monitoring"},{"id":36,"name":"networking"},{"id":7,"name":"node-version"},{"id":55,"name":"nosql"},{"id":57,"name":"observability"},{"id":46,"name":"orm"},{"id":52,"name":"os"},{"id":14,"name":"parser"},{"id":74,"name":"react"},{"id":82,"name":"real-time"},{"id":56,"name":"robot"},{"id":65,"name":"runtime"},{"id":32,"name":"sdk"},{"id":71,"name":"search"},{"id":63,"name":"secrets"},{"id":25,"name":"security"},{"id":85,"name":"server"},{"id":86,"name":"serverless"},{"id":70,"name":"storage"},{"id":75,"name":"system-design"},{"id":79,"name":"terminal"},{"id":29,"name":"testing"},{"id":12,"name":"ui"},{"id":50,"name":"ux"},{"id":88,"name":"video"},{"id":20,"name":"web-app"},{"id":35,"name":"web-server"},{"id":43,"name":"webassembly"},{"id":69,"name":"workflow"},{"id":87,"name":"yaml"}]" returns me the "expected json"