Prerequisites
Before you begin, ensure you have the following installed:- Node.js (v18 or higher)
- pnpm package manager
- Git for version control
- A Notion account with API access
Quick Start
Install dependencies
The project uses pnpm as the package manager:This installs all dependencies including:
- Astro 5.16.9
- Tailwind CSS 4.1.18
- Solid.js 1.9.10 and React 19.2.3
- Notion API client
- Vitest for testing
Configure environment variables
Create a Add your Notion API credentials:
.env file in the project root:Getting Notion IDs:
- Database ID: Last 32 characters of the database URL
- Page ID: Extract from “Copy link” in Notion
- Token: Create an integration at notion.so/my-integrations
Start the development server
- Runs
jiti scripts/index.tsto sync Notion content - Downloads blog posts and projects as MDX files
- Starts the Astro dev server on
http://localhost:4321
The pre-build script automatically syncs content from Notion before starting the dev server. This ensures you’re always working with the latest content.
Project Structure
Understanding the directory layout:Development Scripts
Available npm scripts from package.json:| Script | Command | Description |
|---|---|---|
pnpm dev | astro dev | Start dev server with Notion sync |
pnpm build | astro build | Build for production |
pnpm preview | astro preview | Preview production build |
pnpm test | vitest | Run tests in watch mode |
pnpm coverage | vitest run --coverage | Generate coverage report |
Both
dev and build scripts run predev and prebuild hooks that execute jiti scripts/index.ts to sync Notion content before the main command.TypeScript Configuration
The project uses TypeScript with these key settings (tsconfig.json:1-16):Verifying Your Setup
Check the dev server
Navigate to
http://localhost:4321 in your browser. You should see the home page.Verify Notion sync
Check that MDX files were created:You should see
.mdx files corresponding to your Notion database entries.Troubleshooting
Content Not Syncing
Problem: No MDX files generated insrc/content/
Solutions:
- Verify
.envfile has correctNOTION_TOKENand database IDs - Ensure Notion integration has access to databases/pages
- Check that posts have the
publiccheckbox enabled in Notion - Run the sync script manually:
Port Already in Use
Problem: Port 4321 is already in use Solution: Stop the conflicting process or specify a different port:TypeScript Errors
Problem: Import errors or type mismatches Solutions:- Restart your IDE/editor
- Clear TypeScript cache:
rm -rf node_modules/.astro - Ensure dependencies are installed:
pnpm install
Build Failures
Problem: Build fails with errors Solutions:- Check for missing environment variables
- Verify MDX frontmatter matches schema in
src/content.config.ts - Run with verbose logging:
pnpm build --verbose
Next Steps
Now that your environment is set up:- Learn about development workflows
- Understand styling conventions
- Set up testing
- Explore the codebase structure