https://github.com/4rays/astro-starter
A starter template for Astro.
https://github.com/4rays/astro-starter
Last synced: about 1 year ago
JSON representation
A starter template for Astro.
- Host: GitHub
- URL: https://github.com/4rays/astro-starter
- Owner: 4rays
- Created: 2025-03-11T16:30:08.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-11T19:50:39.000Z (about 1 year ago)
- Last Synced: 2025-03-11T20:27:42.198Z (about 1 year ago)
- Language: Astro
- Size: 73.2 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Astro Starter Kit with Better Auth and Drizzle ORM
This starter kit integrates Astro with Better Auth for authentication and Drizzle ORM for database operations. It includes a complete authentication system with sign-up, sign-in, and user profile functionality.
## 🚀 Features
- **User Authentication**: Complete authentication flow with Better Auth
- **Database Integration**: SQLite database with Drizzle ORM
- **Server-side Rendering**: Full SSR support with Astro
- **Type Safety**: Built with TypeScript for better developer experience
## 📁 Project Structure
```text
/
├── public/
│ └── favicon.svg
├── src/
│ ├── components/
│ │ └── Welcome.astro
│ ├── db/
│ │ ├── index.ts
│ │ └── schema.ts
│ ├── layouts/
│ │ └── Layout.astro
│ ├── lib/
│ │ ├── auth-client.ts
│ │ └── auth.ts
│ ├── pages/
│ │ ├── api/
│ │ │ └── auth/
│ │ │ └── [...all].ts
│ │ ├── signin/
│ │ │ └── index.astro
│ │ ├── signup/
│ │ │ └── index.astro
│ │ └── index.astro
│ └── middleware.ts
├── .env.example
├── astro.config.mjs
├── drizzle.config.ts
├── env.d.ts
└── package.json
```
## 🛠️ Getting Started
1. **Clone the repository**:
```bash
git clone https://github.com/yourusername/astro-starter.git
cd astro-starter
```
1. **Install dependencies**:
```bash
pnpm install
```
1. **Set up environment variables**:
```bash
cp .env.example .env
```
1. **Start the development server**:
```bash
pnpm dev
```
## 🧞 Commands
| Command | Action |
| :-------------- | :--------------------------------------- |
| `pnpm install` | Installs dependencies |
| `pnpm dev` | Starts local dev server with DB setup |
| `pnpm build` | Build your production site with DB setup |
| `pnpm preview` | Preview your build locally |
| `pnpm db-setup` | Generate and push Drizzle migrations |
## 🔐 Authentication Flow
1. **Sign Up**: Users can create an account with name, email, and password
2. **Sign In**: Users can log in with their email and password
3. **Protected Routes**: The home page is protected and requires authentication
4. **Sign Out**: Users can log out from their account
## 🗄️ Database
The application uses SQLite with Drizzle ORM. The database schema includes:
- Users
- Sessions
- Accounts
- Verification tokens
## 📚 Learn More
- [Astro Documentation](https://docs.astro.build)
- [Better Auth Documentation](https://github.com/zenstackhq/better-auth)
- [Drizzle ORM Documentation](https://orm.drizzle.team/docs/overview)