# Astro ATProto OAuth Starter A minimal [Astro](https://astro.build) starter template demonstrating OAuth authentication with AT Protocol (ATProto), the decentralized social networking protocol used by Bluesky and other services. This starter includes: - Complete OAuth authentication flow using `@atproto/oauth-client-node` - Cookie-based session management - Profile display after authentication - Login/logout endpoints - Tailwind CSS and DaisyUI styling ## 🚀 Getting Started 1. **Install dependencies:** ```sh npm install ``` 2. **Configure environment variables:** ```sh cp .env.template .env ``` Edit `.env` if you need to change the port (default: 4321) or set a public URL. 3. **Start the development server:** ```sh npm run dev ``` The app will be available at `http://localhost:4321` 4. **Try logging in:** Enter your AT Protocol handle (e.g., `alice.bsky.social`) to authenticate. ## 📁 Project Structure ```text / ├── public/ ├── src/ │ ├── lib/ │ │ ├── context.ts # OAuth client singleton │ │ ├── oauth.ts # OAuth client configuration │ │ ├── session.ts # Session management │ │ └── storage.ts # Cookie-based stores │ ├── pages/ │ │ ├── api/ │ │ │ ├── login.ts # Login endpoint │ │ │ ├── logout.ts # Logout endpoint │ │ │ └── oauth/ │ │ │ └── callback.ts # OAuth callback handler │ │ └── index.astro # Main page with login UI │ └── styles.css └── package.json ``` ## 🧞 Commands All commands are run from the root of the project, from a terminal: | Command | Action | | :------------------------ | :----------------------------------------------- | | `npm install` | Installs dependencies | | `npm run dev` | Starts local dev server at `localhost:4321` | | `npm run build` | Build your production site to `./dist/` | | `npm run preview` | Preview your build locally, before deploying | | `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | | `npm run astro -- --help` | Get help using the Astro CLI | ## 📚 Learn More - [Astro Documentation](https://docs.astro.build) - [AT Protocol Documentation](https://atproto.com) - [@atproto/oauth-client-node](https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client-node) - [Bluesky](https://bsky.app)