Penstack is a modern, clean, and customizable blog platform built with Next.js, featuring robust analytics, user management, and content creation capabilities.
- Rich text editor with TipTap integration
- Markdown support
- Dynamic table of contents generation
- Post categorization and tagging
- Draft and publishing workflow
- Reading time calculation
- Comprehensive post view tracking
- User engagement metrics
- Device and browser analytics
- Geographic tracking
- Weekly/monthly growth statistics
- Customizable date range analytics
- Integration with Mixpanel, Google Analytics, and Google Tag Manager
- Role-based access control
- Permission system
- User authentication (NextAuth.js)
- Email verification
- Profile management
- Server-side rendering with Next.js
- TiDB (MySQL compatible) database with Drizzle ORM
- TypeScript support
- API rate limiting
- Secure encryption handling
- Responsive design with Chakra UI
- Real-time data updates with React Query
- Clone the repository
git clone <repository-url>
cd penstack-blog
- Install dependencies:
npm install
- Set up your environment variables:
cp .env.example .env
- Initialize the database:
npm run db:setup
- Start the development server:
npm run dev
Visit http://localhost:3000 to see your application.
The project uses MySQL with Drizzle ORM. Available database commands:
npm run db:push # Push schema changes
npm run db:migrate # Run migrations
npm run db:gen # Generate migration files
npm run db:create # Create database
npm run db:seeds # Seed initial data
npm run db:setup # Complete setup
- Built-in XSS protection
- CSRF protection
- Secure session handling
- Encrypted sensitive data
- Rate limiting on API routes
src/
├── app/ # Next.js app directory
├── components/ # React components
├── db/ # Database schemas and config
├── lib/ # Utility libraries
├── utils/ # Helper functions
└── types/ # TypeScript definitions
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
The platform can be configured through the admin dashboard, including:
- Site settings
- Analytics preferences
- Email configuration
- User roles and permissions
- Content moderation settings
For more detailed documentation about specific features:
Create a .env
file with the following variables:
# Database
DB_PORT=3306
DB_USER_NAME=your_username # Required
DB_USER_PASS=your_password # Required
DB_HOST=localhost # Required
DB_NAME=penstack_db # Required
DB_SSL_CONFIG={"rejectUnauthorized": true}
# Site URL
NEXT_PUBLIC_SITE_URL=http://localhost:3000
# Authentication
NEXTAUTH_SECRET=your_nextauth_secret # Required
NEXTAUTH_URL=http://localhost:3000
GOOGLE_CLIENT_ID= # Required
GOOGLE_CLIENT_SECRET= # Required
ADMIN_EMAIL= # Required
ADMIN_PASSWORD= # Required
The project supports deployment on both Vercel and Netlify platforms, with automatic environment configuration.
The next.config.mjs
automatically handles the site URL configuration based on the deployment platform:
- On Vercel: Uses
VERCEL_PROJECT_PRODUCTION_URL
(automatically set) - On Netlify: Uses
URL
(automatically set) - Local Development: Defaults to
http://localhost:3000
-
Vercel (Recommended)
- Deploy directly from your GitHub repository using Vercel Platform
- Vercel will automatically detect your Next.js project and configure the build settings
- No additional URL configuration needed
-
Netlify
- Deploy using the Netlify Platform
- Netlify will automatically configure the site URL
- No additional URL configuration needed
-
Custom Domain
- After deployment, you can configure a custom domain on either platform
- The site URL will automatically update to match your custom domain
For more detailed deployment instructions, refer to: