A modern blog built with Next.js 15, featuring mathematics content, programming tutorials, and more. This project includes PWA capabilities, RSS feed generation, and Docker support.
- Next.js 15 with Turbopack for fast development
- TypeScript for type safety
- Material-UI for modern UI components
- PWA Support with service worker and offline capabilities
- RSS Feed automatically generated from posts
- Syntax Highlighting with Prism and Shiki
- Math Rendering with KaTeX
- Docker Support for containerized deployment
- SEO Optimized with proper meta tags and structured data
- Node.js 22 or higher
- npm 10 or higher
- Docker (optional, for containerized deployment)
git clone <repository-url>
cd blogIf you're using nvm:
nvm use 22
# or install if not available
nvm install 22
nvm use 22Verify your Node.js version:
node --version # Should show v22.x.x
npm --version # Should show v10.x.x or highernpm installnpm run devThe application will be available at:
- Local: http://localhost:3000
- Network: http://192.168.x.x:3000
# Development server with RSS generation
npm run dev
# Build for production
npm run build
# Start production server
npm start
# Generate RSS feed only
npm run generate-rss
# Lint code
npm run lint
# Export static site
npm run export-
Install Docker: Make sure Docker is installed and running
-
Start Docker daemon:
sudo systemctl start docker sudo systemctl enable docker # Enable on boot
-
Add user to docker group (optional, to avoid using sudo):
sudo usermod -aG docker $USER # Log out and back in for changes to take effect
-
Build and run production container:
docker compose up --build
-
Run in background:
docker compose up --build -d
-
Development mode with hot reload:
docker compose --profile dev up blog-dev --build
-
View logs:
docker compose logs -f
-
Stop containers:
docker compose down
-
Build production image:
docker build -t mathbugs-blog . -
Run production container:
docker run -p 3000:3000 --name mathbugs-blog-container mathbugs-blog
-
Build development image:
docker build -f Dockerfile.dev -t mathbugs-blog-dev . -
Run development container with volume mounting:
docker run -p 3001:3000 \ -v $(pwd):/app \ -v /app/node_modules \ -v /app/.next \ --name mathbugs-blog-dev-container \ mathbugs-blog-dev
-
Install Vercel CLI:
npm install -g vercel
-
Deploy:
vercel
-
Production deployment:
vercel --prod
-
Build production image:
docker build -t mathbugs-blog:latest . -
Run with environment variables:
docker run -d \ -p 3000:3000 \ --name mathbugs-blog \ --restart unless-stopped \ -e NODE_ENV=production \ mathbugs-blog:latest
-
Using docker-compose for production:
docker compose -f docker-compose.yml up -d
-
Build the application:
npm run build
-
Start with PM2 (process manager):
npm install -g pm2 pm2 start npm --name "mathbugs-blog" -- start pm2 save pm2 startup -
Using systemd service: Create
/etc/systemd/system/mathbugs-blog.service:[Unit] Description=MathBugs Blog After=network.target [Service] Type=simple User=www-data WorkingDirectory=/path/to/blog ExecStart=/usr/bin/npm start Restart=on-failure [Install] WantedBy=multi-user.target
Enable and start:
sudo systemctl enable mathbugs-blog sudo systemctl start mathbugs-blog
For static hosting (GitHub Pages, Netlify, etc.):
-
Update next.config.ts for static export:
const nextConfig: NextConfig = { reactStrictMode: true, output: "export", images: { unoptimized: true, }, };
-
Build and export:
npm run build npm run export -
Deploy the
out/directory to your static hosting provider.
Create a .env.local file for local development:
# Optional: Disable Next.js telemetry
NEXT_TELEMETRY_DISABLED=1
# Add your custom environment variables here- Posts: Add markdown files to the
posts/directory - Styling: Modify CSS files in
src/styles/ - Components: Edit React components in
src/components/ - Configuration: Update
next.config.tsfor build settings
βββ public/ # Static assets
βββ src/
β βββ components/ # React components
β βββ pages/ # Next.js pages
β βββ styles/ # CSS styles
β βββ lib/ # Utility functions
βββ posts/ # Blog posts (Markdown)
βββ scripts/ # Build scripts
βββ Dockerfile # Production Docker image
βββ Dockerfile.dev # Development Docker image
βββ docker-compose.yml # Docker Compose configuration
βββ next.config.ts # Next.js configuration
-
Docker daemon not running:
sudo systemctl start docker
-
Permission denied for Docker:
sudo usermod -aG docker $USER # Log out and back in
-
Node.js version mismatch:
nvm use 22
-
Build failures:
rm -rf node_modules package-lock.json npm install
-
Port already in use:
# Kill process on port 3000 lsof -ti:3000 | xargs kill -9
If you see warnings about version being obsolete, remove the first line from docker-compose.yml:
# Remove this line:
version: '3.8'
# Keep this:
services:
# ... rest of configurationThis project is licensed under the MIT License - see the LICENCE file for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
For issues and questions, please open an issue on the GitHub repository.
Happy coding! π