Truffle AI is a platform helping VC analysts find early stage tech startups. It automatically collects traces founders leave on the internet, visualizes them in a compelling way and makes it easy for investors to keep track of and potentially reach out to startups they discover.
Install the following extensions:
To configure your project for your environment, fill in the values in values/input
for your environment (commit, staging, production) and remove the example.
prefix.
Then run task values:generate
to generate the Kubernetes ConfigMaps and Secrets in ./k8s
, as well as the .env
files for all environments (commit, staging, production) in ./envs
.
Next fill in ./envs/.env
the missing values.
Environment variables are loaded in the order .env
, .env.${ENV}
and then .env.local
for local development.
Just start all services with ENV=commit t dev
You can now deploy the application. See the Taskfiles.
You can see all Taskfile commands by executing t --list-all
.
The architecture is divided in frontend (UI) and backend (Gateway, Supabase, GraphQL-Server). The backend is either reached directly from the UI in the case of Supabase or via the Gateway. An NGINX ingress controller load balances the backend services except Supabase.
The Postgre database is hosted on Supabase with activated role-level security. It is normalized for 3rd Normalform. Supabase provides a GraphQL Layer via the pg_graphql extension, the UI makes extensive use of this GraphQL API. Authentication is also done via Supabase.
The golang gateway acts as a proxy, that proxies requests to Supabase and GraphQL Server. Before it proxies, it authenticates requests. It can also accept User API Keys to authenticate users.
The golang graphql server allows to mutate data in the database for complex operations that require custom server logic. It is able to scrape multiple services in realtime and add the data to the database. It also runs cronjobs that update the database data continously.
The Svelte 5 UI is integrated with Shadcn, TailwindCSS, Biome. It usually makes requests via the Apollo GraphQL clients to the Gateway or Supabase directly.
(./.github)
This module contains GitHub Actions for assigning the creator of a PR, verifying PRs, testing and building the packages
, build the Docker Images and create a released version based on Git Tags.
(./db)
Contains the sql files. Has Taskfile commands to delete all tables, policies, types etc. and recreate them via psql.
(./docker)
Contains Docker Compose files for local testing.
(./envs)
Contains all the environment variables (.env, .env.commit, .env.staging, .env.production, .env.local).
(./k8s)
Contains the helm charts and the scripts to deploy the application via helm.
(./packages)
There are four main packages in ./packages
.
Used to test external APIs like ScrapingBot to get exact output formats. Important for designing the database tables.
A golang gateway server, that authenticates any requests and proxies them to the Supabase GraphQL API or graphql-server
. It also accepts userapikey headers to identify a user and give him access to the app's API infrastructure.
A golang graphql server that updates the data in the database periodically via cronjobs, allows to fetch data in the future via realtime over graphql subscriptions and inserts new bookmarks to the database in realtime, which requires scraping that is done concurrently.
A server used to access grok AI and generate text based on repository input. Not included in the deployment.
Contains the frontend of Truffle AI. It connects with the Supabase API directly via a GraphQL Client to load content from the database. Another client then connects with graphql-server
to be able to add bookmarks via the application logic of our own server.
Contains the terraform files to create the infrastructure of the application on DigitalOcean.
Contains the input for the values used by Kubernetes and the environment variables, contains scripts to generate these values for Kubernetes and .env files.
Over the course of this project, several technologies were used and later replaced. Here's a list of those technologies and what they were replaced with:
Each of these technologies served a purpose at the time, but were eventually replaced as the needs of the project evolved.
It might be necessary to apply the proxy-protocol
to the nginx-ingress-controller config map manually like described here and rollout restart afterwards:
kubectl rollout restart deployment ing-controller-release-nginx-ingress-nginx-ingress-controller