Prerequisites
Before you begin, ensure you have the following installed:- Node.js 18+ - Required for Next.js 14
- PostgreSQL - Database for storing users, clients, and reports
- Google Cloud Console project - For OAuth and API access
- Git - For version control
Installation
1. Clone the Repository
2. Install Dependencies
Install all required npm packages:prisma generate via the postinstall script to generate the Prisma Client.
3. Environment Configuration
Copy the example environment file:4. Database Setup
Run database migrations to create the schema:5. Start Development Server
Launch the development server:Available Scripts
Development Commands
Database Commands
Project Structure
Reportr follows a structured approach based on Next.js 14 App Router and atomic design principles:Path Aliases
The project uses TypeScript path aliases for cleaner imports:Usage Example
TypeScript Configuration
Reportr uses strict TypeScript mode for maximum type safety:noImplicitAny: true- All variables must have explicit typesstrictNullChecks: true- Proper null/undefined handling requirednoUncheckedIndexedAccess: true- Array/object access returns T | undefined- Target: ES2020 with DOM libraries
Google Cloud Setup
To enable authentication and API integrations, you need to configure a Google Cloud project:1. Create a Google Cloud Project
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable billing (required for API access)
2. Enable Required APIs
Enable the following APIs in your project:- Google Search Console API
- Google Analytics API (v4)
- Google Analytics Admin API
- PageSpeed Insights API
3. Configure OAuth 2.0
- Navigate to APIs & Services > Credentials
- Click Create Credentials > OAuth 2.0 Client ID
- Configure the OAuth consent screen
- Add authorized redirect URI:
http://localhost:3000/api/auth/callback/google - Copy the Client ID and Client Secret to your
.envfile
4. Create API Key for PageSpeed
- In Credentials, click Create Credentials > API Key
- Copy the API key to
PAGESPEED_API_KEYin your.envfile
Next Steps
After completing the setup:- Review the Environment Variables documentation
- Learn about the Database Schema
- Read the development guidelines in
CLAUDE.mdin the source repository - Start building features following the atomic design principles
Troubleshooting
Database Connection Issues
If you encounter database connection errors:- Verify PostgreSQL is running
- Check the
DATABASE_URLformat in.env - Ensure the database exists:
createdb seo_reportbot - Try
npm run db:pushto sync the schema