1
Install
awaitiois the server, the action runtime and the UI.@awaitio/theme-defaultis how the UI looks.@awaitio/input-textis the text field the action will ask with.
2
Create a session secret
Run this:and put its output into What’s happening here
.env:.env
- The secret is a random string that signs the login cookies.
- It goes into
.env, never into the repository; changing it logs everyone out.
3
Create the app
app.ts
nameis shown on the login page, in the header and in the browser tab.actionsDirectoryis the folder with your actions: every file in it is one action.themedecides how everything looks.usersis who can log in: each person with an email, a name and a hash of their password. AwaitIO has no sign-up and no user database; the list lives in your code.componentsdecides whatiooffers:input: { text: inputText }givesio.input.text().
4
Write an action
actions/greet.ts
- Every file in
actions/is one action;app.action()gives it aniotyped by the components you registered. - The handler stops at
await io.input.text()until someone answers in the browser, then goes on. - What it returns is shown as the result.
5
Start the server
server.ts
listen()loads every file inactionsDirectoryand opens the port; the file’s path is the action’s URL:actions/greet.tsis at/actions/greet.watchrestarts the server whenever you save a file;--env-file=.envpasses the session secret.- The server listens on
127.0.0.1only, so nobody else on the network can reach it yet.
6
Create your account
Open http://localhost:3000, click Create new account and fill in your email, name and a password of at least 10 characters. It gives you one line; paste it into What’s happening here
users in app.ts:app.ts
- The line holds only a hash of your password; the password itself is not stored anywhere.
- Saving
app.tsrestarts the server, and the new user can log in. - Everyone else gets in the same way: they click Create new account and send you their line, so their password never reaches you.
7
Log in and run it
Open http://localhost:3000, log in with your email and password, pick Greet, type a name and press Continue.