Skip to content
    Back to all Bounties

    Earn 45,000 ($450.00)

    Time Remainingdue 9 months ago
    Canceled

    [reopened] Rust Postgres Proxy for a popular open source project

    felix54
    felix54
    Posted 11 months ago

    Bounty Description

    [Edit: reopened since applicant disappeared]

    We are a building an Open Source CRM https://github.com/twentyhq/twenty (15k stars)

    A CRM is a big UI over a system of records. One of the strength of Twenty is that we give each workspace a lot of flexibility over the data structure. They can create custom object, fields, etc.

    For our data-model, we opted for a singular approach which gives us the scaling capacity and simplicity of multi-tenancy, and the flexibility of single-tenant setup. We have 1 single Postgres DB with 1 schema for each tenant. Which means if a user creates a new object we create an actual table in Postgres, and if they create a custom field we create a column in Postgres. We've built a custom engine that orchestrates thousands of migrations overs thousands of schemas/tables that live in a single Postgres server. 1 workspace in Twenty = 1 schema in Postgres.

    This allows us to create one user in Postgres with restricted permissions for each tenant to give them a direct access to their CRM data. No vendor lock-in or painful "csv extract", with that project they will be able to connect a tool like Metabase or Tableau directly to their data in Twenty!

    We don't want to expose our Postgres database publicly to the world by default, instead we want this feature to be opt-in only. Eventually users should be also be able to only allow whitelist IPs. That's the goal of this project: create a small Rust proxy that will allow us to safely expose the Postgres database.

    We've started building the endpoint on the javascript application layer to generate credentials for a given schema: https://github.com/twentyhq/twenty/pull/5767

    Now the next step is to build that proxy which will selectively give access to the database for users who have opted into having a direct access to their Postgres schema.

    For that we should use the following library: https://github.com/sunng87/pgwire

    A similar example of what we want to achieve has been attempted here but the code is already slightly outdated and was not finished: https://github.com/sunng87/pgwire/pull/138

    What we would like is for you to create a new package in the Twenty repo, called twenty-postgres-proxy. This will be a small server, acting as a proxy over Postgres, and managing the security.

    The code should be clean and tested. Since it's open source you are free to share the code with anyone, publish it as a library under your own name, etc. We are not in anyway related to pgwire, but you are most welcome to contribute to pgwire examples folder / and share your solution with the community here: https://github.com/sunng87/pgwire/issues/80 - if you don't do it, we will.

    Edit: please don't generate your application with AI. A short paragraph written with your own words is better than a wordy AI-generated response. Talk about your experience in Rust. Thanks