We have invited complexity through the door, but it will not leave as easily.
However, there is a concept called Radical Simplicity.
One way to simplify your stack, reduce the moving parts, speed up development, lower risks, and deliver more features in your startup is to "Use Postgres for everything." Postgres can replace many backend technologies — such as Kafka, RabbitMQ, Mongo, and Redis — even for applications with millions of users.
This approach makes every application easier to develop, scale, and operate.
Fewer moving parts mean fewer developers needed for components that don’t provide value or simply replicate existing functionality (like the frontend), allowing more developers to focus on parts (like the backend) that do provide value to customers. Imagine increasing feature output by 50% without higher costs. For developers, this also means a lower cognitive load. You can deeply understand all the moving parts, alleviating the imposter syndrome.
Use PostgreSQL for Everything
- Use PostgreSQL for caching by employing UNLOGGED tables and using TEXT as a JSON data type instead of Redis.
- Utilize stored procedures or tools like ChatGPT to automate tasks such as adding and managing data expiry, similar to how Redis functions.
- Use PostgreSQL as a message queue with SKIP LOCKED instead of Kafka (if a simpler message queue suffices). Alternatively, employ it as a job queue in Go with River.
- Use PostgreSQL with Timescale for efficient data warehousing.
- Use PostgreSQL with pg_analytics for real-time OLAP capabilities using Apache Datafusion.
- Use PostgreSQL's JSONB features to store and search JSON documents effectively, replacing traditional MongoDB setups.
- Use PostgreSQL as a cron demon with pg_cron for scheduling tasks such as sending emails, and seamlessly add events to a message queue.
- Use PostgreSQL for geospatial queries, integrating spatial data seamlessly into applications.
- Use PostgreSQL for full-text search functionality, eliminating the need for additional tools like Elasticsearch.
- Use PostgreSQL's capability to generate JSON directly within the database, simplifying API data delivery without server-side code.
- Use PostgreSQL with pgaudit for comprehensive auditing capabilities.
- Integrate PostgreSQL with a GraphQL adapter to efficiently deliver GraphQL APIs when needed.
In summary, consider PostgreSQL as your versatile solution for various backend tasks, streamlining development, scaling, and operational efficiency across applications.