DEV Community

Cover image for Could Your Serverless Database Be Costing You Too Much? Meet Coldbase.
Yosbel Marín
Yosbel Marín

Posted on

Could Your Serverless Database Be Costing You Too Much? Meet Coldbase.

Building serverless apps is great, right? Fast to build, scales easily. But sometimes, those database bills can be a surprise. Popular serverless databases often come with costs that grow quickly.

What if there was a different way? A simpler database designed for serverless that helps you manage costs better?

That's where Coldbase comes in.

Coldbase is a small, serverless-focused database. It uses affordable cloud storage, like AWS S3 or Azure Blob, to keep your data. It's a different approach to storing data in serverless environments. It is currently in Beta, and we welcome your feedback as we continue to refine it.

Why Database Costs Can Add Up

Serverless databases are great for many things, but their pricing can sometimes be high. They often charge based on how many reads and writes you do. As your app gets more users, these costs can increase quickly.

Coldbase's Simple Idea: Cloud Storage as Your Database

Coldbase takes a different path. It uses standard cloud storage (like S3 or Azure Blob) as its foundation. These services are known for being very affordable, especially for storing lots of data and handling many operations.

By building on this low-cost storage, Coldbase aims to give you significant savings on your database bill. We've seen it be much cheaper than some traditional options. For a more detailed look at the cost difference, you can check our comparison here.

Coldbase Features: Simple Tools for Serverless

Coldbase offers features to help you build serverless applications more efficiently:

  • Works with Serverless: Designed for serverless functions (like AWS Lambda). It doesn't hold data in memory between calls, which fits the serverless way.
  • Affordable Storage: Uses cloud storage you already know (AWS S3, Azure Blob, or local files) to keep costs low.
  • Vector Search: If you're working with AI, it can store and search vector embeddings. This can be useful for semantic search or RAG applications.
  • Automated Housekeeping: It can automatically tidy up your data files (compaction and vacuuming) in the background, without you needing to manage it.
  • Easy Data Access: Find your data with simple queries, filtering, and pagination.
  • Batch Operations & TTL: Write many items at once or set data to expire automatically.
  • HTTP API Option: You can quickly add a REST API using Hono, complete with basic security and documentation.

Quick Start: Try Coldbase with AWS S3

Want to see Coldbase in action with a cloud storage backend? Here’s a simple example using AWS S3.

import { Db, S3Driver } from 'coldbase'
import { S3Client } from '@aws-sdk/client-s3'

interface User {
  id: string
  name: string
  email: string
  role: string
}

// Configure your S3 client
const s3Client = new S3Client({ region: 'us-east-1' })

// Instantiate S3Driver with your bucket name and S3 client
const db = new Db(new S3Driver('my-coldbase-bucket', s3Client))
const users = db.collection<User>('users')

// Add a new user
await users.put({ id: 'u1', name: 'Alice', email: 'alice@example.com', role: 'admin' })

// Find a user
const user = await users.get('u1')
console.log('Found user:', user)

// Get all admins
const admins = await users.find({ where: { role: 'admin' } })
console.log('Admins:', admins)

// Remove a user
await users.delete('u1')
console.log('User u1 deleted.')
Enter fullscreen mode Exit fullscreen mode

Coldbase is a practical way to manage data in serverless applications, with a focus on cost-efficiency. If you're looking for an alternative to high database bills, consider giving Coldbase a try.

Repo here

Top comments (0)