This is a template (under 5k tokens in size), made from first principles, for:
- Secure login via X OAuth
- User managment via dorm (powered by outerbase)
Use this boilerplate fore easy creation of apps that require X login
To use this:
- make a client at https://developer.x.com
- make sure to provide the right "User authentication settings", specifically the callback URLs should include https://your-worker.com/callback
- Ensure to get the OAuth client/secret, as highlighted below
- gather all vars in both
.dev.varsandwrangler.toml, and in your deployed secrets
You can add as many callbacks as you want (for all your X oauthed workers)!
- To explore the data in the DB: https://studio.outerbase.com/local/new-base/starbase and fill https://login.xymake.com/admin
- Find me on X if you have any questions
TODO:
- ✅ successfully have one db per user but with a global mirror-db
- ✅ Remove stripe webhook into separate handler for now. This'd be a different middleware.
- ✅ updated to use latest dorm version that has migrations and other better stuff. Removed stripe from template
- Make
x-oauth-templatefully oauth2.1 compatible. Useoauth21-mcp-openapias guideline. Make this a middleware that takes the dorm client, and assumes a table structure. - Implement spec of https://murlprotocol.com with this template as middleware, such that the flow becomes:
- x login -> stripe payment -> dashboard with balance
- login with monetaryurl with permissions
- from uithub dashboard, add monetaryurl full permission to balance via xlogin --> stripe payment
- when an uithub request is made, a murl is made first and send along into the url chain. every server deducts the desired balance afterwards.


