Skip to content

tursodatabase/embedded-replicas-with-js

Repository files navigation

Embedded Replicas with JavaScript

A personal expenses tracking application built with Elysia, Bun, and Turso's Embedded Replicas.

Getting Started

Create a turso database.

turso db create <db-name>

Get the database credentials:

# db url
turso db show --url <db-name>

# authentication token
turso db tokens create <db-name>

Rename .env.example to .env and update the database credentials with the values obtained above.

TURSO_DATABASE_URL=
TURSO_AUTH_TOKEN=

Install the project's dependencies:

bun install

Create the local database folder and an empty database:

mkdir dbs
touch dbs/expenses.db

Development

To start the development server run:

bun run dev

Sending Requests

Add a new expense:

curl "http://127.0.0.1:$PORT/records" \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"amount": 200,"information": "Bought something nice!"}'

Get all expenses:

curl "http://127.0.0.1:$PORT/records"

Note

Info The $PORT above is the value you used in the PORT key inside the .env file.

About

A personal expenses tracker

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •