- Create a new local-first project using create-lofi-app
- Create a simple To-Do UI
- Connect to a Basic project and set up your schema
- Add sign in and sign out functionality
- Hook up to Basic DB so that your users can save their to-dos across their devices
Create a new local-first project
1
Create a new local-first project
Terminal
y
for installing the vite package.
Then give your project a name.
And finally choose the Basic + Tailwind variant.2
install npm packages
cd project-name
into your project, run npm i
, and start your server with npm run dev
:Terminal
http://localhost:5173
and see the app running as below:

Create a simple To-Do UI
We’ll replace the existing homepage UI with a simple To-Do app UI using Tailwind that comes preinstalled with the create-lofi-app template.1
Delete the existing homepagecode
Let’s replace the code in your
src/App.tsx
file with the following for a clean slate:2
Add an input + button
Let’s add an input, and a button to the app, and add some basic Tailwind styling
App.tsx

Connect to a Basic project and set up your schema
The fastest way to connect to a Basic project is to use the Basic CLI.1
Install the Basic CLI
Make sure you are in the directory of your project.You’ll be redirected in your browser to sign up for a Basic account and login.
Once you’ve logged in, you’ll be able to connect to a Basic project.
Terminal
2
Connect to a Basic project
Terminal
Create new project

typescript
and hit Yep!

3
Set up your schema
If you navigate to the
src/basic.config.ts
file, you’ll see that it’s already set up for you now with a schema object with a project_id
!Let’s change the schema to match the needs of our To-Do app, and add a name string field and a completed boolean field.basic.config.ts
4
Push the changes to our schema
Terminal
Add sign in and sign out functionality
It’s very easy to add the ability to have your users sign in and sign out of your to-do app.1
Add a login and logout button to App.tsx
Now navigate to
src/App.tsx
and import signin
, signout
, isSignedIn
, and user
.App.tsx

Hook up to Basic DB
Now that we have the ability to sign in and sign out, we can hook up to Basic DB so that our users can save their to-dos across their devices.1
Submit a task to Basic DB
We will add some state to capture our input value, implement the
.add()
method, and then console.log
the result.App.tsx
2
Read and display the tasks
Now let’s retrieve and display the tasks!With just a few lines you were able to display your tasks as such:
App.tsx

3
Add a delete button
Now let’s add a delete button to our tasks using the The delete button would look like this:
.delete()
method.App.tsx
