Private apps and sharing
Private until you share it, and your app never handles a login.
Private by default
A new app opens only for the account that deployed it. Everyone else is asked to sign in, and is turned away unless their email address is on the app's list or at an email domain you added.
Share by email
$ shim share mom@example.com
mom@example.com can now open https://budget.shim.live
Emailed mom@example.comThe person gets an email with the link. You can share with several addresses at once, and you can do the same from the Access tab of the app in the dashboard.
$ shim access # who can open it $ shim unshare mom@example.com
Removing someone ends their access within seconds. Nothing is rebuilt or redeployed.
Share with everyone at a domain
$ shim share @acme.com # anyone with an address at acme.com $ shim unshare @acme.com
Anyone who signs in with a verified address at that domain can open the app, without being added one by one. The address must be exactly at the domain: a rule for acme.com does not cover mail.acme.com, which needs a rule of its own. No email is sent when you add a rule.
Public mail providers such as gmail.com, outlook.com, yahoo.com, icloud.com and proton.me are refused, because anyone can get an address there. Share with those addresses one by one.
An app can have 1 domain rule on the free plan and 10 on pro, apart from the people limit. Removing a rule ends access within seconds for everyone it let in, unless their own address is on the list. You can also manage rules on the Access tab of the dashboard, or with share_domains in shim.toml.
Public paths on a private app
Some parts of a private app may need to answer without a sign-in, such as a health check or a webhook from a payment provider. List up to 10 path prefixes that anyone may reach; the rest of the app stays private.
$ shim paths add /health /webhooks/ $ shim paths # list them $ shim paths remove /health
/healthopens/healthand everything under/health/, but not/healthz./webhooks/opens everything under/webhooks/, but not/webhooksitself.- Matching is exact and case-sensitive, so
/healthdoes not open/Health. The query string is not part of the match. - Shim matches the same path your app receives, after resolving
.and..segments and backslashes the way a browser does. A path that still contains percent-encoding, a doubled slash or a semicolon is never public: it takes the normal sign-in route. - A prefix may use letters, digits, dots, hyphens, underscores, tildes and slashes, with no
.or..segments./on its own and prefixes that start with/__shimcannot be made public; to open the whole app, make it public. - Requests on a public path carry no
x-shim-userheader, even from a signed-in visitor or from you, and are not written to the access log. Requests made by pages on other sites are not blocked there, but they reach your app without the visitor's cookies. - Anyone on the internet can call a public path, and every call counts toward your monthly requests. Do not list a prefix that also serves private data, such as a framework's data or image routes.
- Shim slows a flood: past roughly 120 calls a minute to an app's public paths from visitors who are not signed in, further calls get a 429 for the rest of that minute and show as Public path limit in the request log. Under heavy load the ceiling is higher, so it limits the damage and does not replace the monthly limit.
Changes take effect within about 15 seconds. You can also manage public paths on the Access tab of the dashboard, or with public_paths in shim.toml. They matter only while the app is private.
What the visitor sees
- They open the app's address and are sent to a Shim sign-in page that names the app.
- They type their email address and get a 6-digit code by email. There is no password and no account to set up.
- They enter the code and land in the app, on the page they asked for.
They stay signed in to that app for 7 days in that browser. If the last step of sign-in fails, because its link expired, was already used, or was opened in a different browser from the one that started it, the visitor sees a page that says so, with a button that starts sign-in again for the same app on that device.
Someone who has not been given access sees a page that says so and shows the address they signed in with. From there they can switch to another account or ask you for access.
To sign out, a visitor opens /__shim/logout on the app's address, for example https://budget.shim.live/__shim/logout, and confirms. Your app can simply link there. Afterwards the page offers to sign in again or with a different email address.
Requests for access
A signed-in visitor who has not been given access can press Request access. You get an email, and the request shows on the Access tab of the dashboard and in shim access requests.
$ shim access requests # pending access requests $ shim access approve ann@acme.com $ shim access deny bob@example.com
- Approving adds the address to the list, where it counts toward the people limit, and emails the person.
- Denying drops the request quietly. The person is not told, and cannot ask again for that app until 30 days after they asked.
- A request expires after 30 days. At most 20 requests can wait for one app; further ones are not recorded until some are approved, denied or expire.
- You get at most 5 request emails for one app in 24 hours, and 10 across all your apps, and none for an app whose Email alerts are off. Requests still show in the dashboard and in
shim access requestseither way. - The visitor gets the same answer whether or not the app exists, so asking reveals nothing.
Who opened it
Shim keeps a log of who signed in to a private app, when, and how they got in: as the owner, as an address on the list, or through a domain rule.
$ shim access log- There is one row per person per day (UTC), with how many times they signed in that day. A row is marked as a first visit when the person had not signed in to the app in the 30 days before.
- It records sign-ins, not page views. A visitor signs in once per browser every 7 days, so a regular visitor may appear once a week. A row is written when Shim approves the sign-in, so a sign-in that was approved but never finished in the browser is listed too. Requests on public paths are not logged.
- Rows are deleted after 30 days. Only you can see the log, on the Access tab of the dashboard and with
shim access log.
The x-shim-user header
Every request from a signed-in visitor that reaches a private app outside its public paths carries their verified email address:
x-shim-user: mom@example.com
Shim removes any x-shim- header sent by the browser before the request reaches your app, so the value can be trusted. Your app needs no login code: read the header if you want to know who is there.
Requests to a public app, and to the public paths of a private app, carry no x-shim-user header, even when the visitor is signed in.
Request ids
Every request to your app carries an id in x-shim-request-id, and the visitor's response carries the same header. Log it with your own lines and database queries, and one id follows a request from the browser to your app to its database. Requests also carry a W3C traceparent header, which OpenTelemetry libraries pick up on their own. To see one request and what the app wrote while handling it, run shim logs --request-id <id> (more).
Public apps
$ shim public # anyone with the address $ shim private # back to you and the people on the list
The list of people is kept while the app is public and applies again when it goes private.
Good to know
- A request to a private app that is not a page visit and has no signed-in visitor, such as a script calling an API, gets
401. To let one of your own apps call another, use Connected apps; to let a webhook or health check in, use public paths. - A private app does not accept requests made by pages on other sites with the visitor's session; they get
403. - Paths that start with
/__shim/belong to Shim and never reach your app. Besides the sign-out page, aPOSTto/__shim/logoutfrom a page of the app signs the visitor out straight away.