/embedded-replicas-with-js

A personal expenses tracker

Primary LanguageTypeScriptMIT LicenseMIT

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

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 '{"ammount": 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.