Update README for template usage

Completely rewrote README to focus on template functionality:
- Clear "Use This Template" instructions
- Quick 3-step deployment guide
- Comprehensive customization guide
- AI agent modification documentation
- Environment variables reference table
- Troubleshooting section
- First-time setup instructions

Removed old deployment-specific content and replaced with
template-focused documentation for 10,000+ users to fork and customize.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Mikael Westöö
2026-01-23 23:30:31 +01:00
parent 7347586407
commit 7cbe3de772

567
README.md
View File

@@ -1,277 +1,271 @@
# Ryans Recruit Firm - AI Recruitment Site
# AI Recruitment Site Template
A professional recruitment website built with Node.js, Express, and PostgreSQL. Features include job listings, application management, CV storage, and admin dashboard.
A fully customizable recruitment website template designed for easy deployment and AI agent modification. Built with Node.js, Express, and PostgreSQL with comprehensive environment-based configuration.
## Features
## 🎯 Use This Template
This repository is marked as a template. You can create your own recruitment site in minutes!
### Quick Start (3 Steps)
1. **Use this template** - Click "Use this template" on Gitea
2. **Customize** - Edit `.env` file with your company information
3. **Deploy** - Run the automated deployment script
## ✨ Features
### Public Features
- **Job Listings** - Browse open positions with detailed information
- **Online Applications** - Submit applications with CV upload
- **Contact Form** - Get in touch with the recruitment team
- **Responsive Design** - Works on desktop, tablet, and mobile
- Job listings with search and filters
- Online application system with CV upload
- Contact form
- Fully responsive design
- Dynamic branding and content
### Admin Features
- **Dashboard** - Overview statistics and quick access
- **Application Management** - View, filter, and manage applicants
- **CV Downloads** - Download applicant CVs directly
- **Job Management** - Create, edit, and manage job postings
- **First-time Setup** - Automatic admin account creation on first login
- Dashboard with statistics
- Application management
- CV downloads and viewing
- Job posting management
- First-time admin account creation
## Technology Stack
### Template Features
- **Environment-based configuration** - All customization via `.env` file
- **Dynamic branding** - Company name, colors, contact info all configurable
- **AI agent friendly** - Clear structure for automated modifications
- **One-click deployment** - Automated Coolify deployment script
- **No hardcoded values** - Everything is configurable
- **Backend**: Node.js + Express
- **Database**: PostgreSQL with BYTEA for CV storage
- **Authentication**: Session-based with bcrypt
- **File Upload**: Multer (PDF, DOC, DOCX support)
- **Deployment**: Docker + Docker Compose + Coolify
## Quick Start
### Local Development
1. **Clone the repository**
```bash
git clone <repository-url>
cd ai-recruit-site-template
```
2. **Install dependencies**
```bash
npm install
```
3. **Set up environment**
```bash
cp .env.example .env
# Edit .env with your configuration
```
4. **Start PostgreSQL** (if not using Docker)
```bash
# Install PostgreSQL and create database 'recruitment'
psql -U postgres -c "CREATE DATABASE recruitment;"
```
5. **Run migrations**
```bash
psql -U postgres -d recruitment -f migrations/001_init_schema.sql
psql -U postgres -d recruitment -f migrations/002_seed_data.sql
```
6. **Start the application**
```bash
npm start
```
7. **Access the site**
- Public site: http://localhost:3000
- Admin panel: http://localhost:3000/admin/login
### Docker Development
1. **Start all services**
```bash
docker-compose up -d
```
2. **View logs**
```bash
docker-compose logs -f app
```
3. **Stop services**
```bash
docker-compose down
```
## Deployment to Coolify
## 🚀 Quick Deployment
### Prerequisites
- Coolify account and API token
- Gitea repository
- Cloudflare account (for DNS)
- Gitea account at git.startanaicompany.com
- Gitea API token
- Coolify API token (for deployment)
- Basic command line knowledge
### Environment Variables
### Step 1: Create Your Copy
Use Gitea's template feature to create your own copy:
```bash
export COOLIFY_TOKEN="your-coolify-api-token"
export GITEA_TOKEN="your-gitea-access-token"
export CLOUDFLARE_TOKEN="your-cloudflare-api-token"
export COOLIFY_API="https://app.coolify.io/api/v1"
export GITEA_API="https://git.startanaicompany.com/api/v1"
export CLOUDFLARE_API="https://api.cloudflare.com/client/v4"
# Or clone the template manually
git clone https://git.startanaicompany.com/StartanAICompany/ai-recruit-site-template.git my-recruit-site
cd my-recruit-site
```
### Step 1: Generate SSH Deploy Keys
### Step 2: Customize Configuration
```bash
ssh-keygen -t ed25519 -f /tmp/recruitai_deploy_key -C "coolify-recruitai-deploy" -N ""
# Copy the example environment file
cp .env.example .env
# Edit .env with your company information
nano .env
```
### Step 2: Create Coolify Project
**Minimum required configuration in `.env`:**
```bash
curl -s -X POST "${COOLIFY_API}/projects" \
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"name": "RecruitAI",
"description": "AI Recruitment Site"
}'
# Company Information
COMPANY_NAME="Your Recruitment Firm"
COMPANY_TAGLINE="Your Tagline Here"
COMPANY_DESCRIPTION="Your company description"
# Branding Colors
PRIMARY_COLOR=#2563EB
ACCENT_COLOR=#059669
DARK_COLOR=#1E293B
# Contact Information
CONTACT_EMAIL=info@yourcompany.com
CONTACT_PHONE=+1 (555) 123-4567
CONTACT_ADDRESS=123 Business St, City, State 12345
# Deployment Configuration
SUBDOMAIN=yourname
GITEA_USERNAME=your-gitea-username
GITEA_REPO_NAME=my-recruit-site
```
### Step 3: Add Deploy Key to Coolify
### Step 3: Deploy to Coolify
```bash
PRIVATE_KEY=$(cat /tmp/recruitai_deploy_key | jq -R -s .)
# Set API tokens as environment variables (NOT in .env)
export COOLIFY_API_TOKEN="your-coolify-token"
export GITEA_API_TOKEN="your-gitea-token"
curl -s -X POST "${COOLIFY_API}/private-keys" \
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \
-H "Content-Type: application/json" \
-d "{
\"name\": \"recruitai-deploy-key\",
\"description\": \"Deploy key for recruitai repository\",
\"private_key\": ${PRIVATE_KEY}
}"
# Copy and run the deployment script
cp deploy-to-coolify.example.sh deploy-to-coolify.sh
chmod +x deploy-to-coolify.sh
./deploy-to-coolify.sh
```
### Step 4: Push to Gitea
The script will:
- Create a Coolify application
- Configure domain (yourname.recruitai.startanaicompany.com)
- Set up webhooks for automatic deployments
- Generate database and session secrets
- Trigger initial deployment
**Your site will be live in 2-3 minutes!**
## 🎨 Customization Guide
### Company Information
All company information is configured via environment variables in `.env`:
```bash
git remote add origin git@git.startanaicompany.com:username/ai-recruit-site-template.git
git add .
git commit -m "Initial commit: AI Recruitment Site"
git push -u origin main
# Company Identity
COMPANY_NAME="Your Recruitment Firm"
COMPANY_TAGLINE="Finding the Perfect Match for Your Career"
COMPANY_DESCRIPTION="We specialize in connecting talented professionals..."
# Contact Details
CONTACT_EMAIL=info@yourcompany.com
CONTACT_PHONE=+1 (555) 123-4567
CONTACT_ADDRESS=123 Business St, Suite 100, City, State 12345
BUSINESS_HOURS=Monday - Friday: 9:00 AM - 6:00 PM
# Social Media (leave empty to hide)
SOCIAL_LINKEDIN=https://linkedin.com/company/yourcompany
SOCIAL_TWITTER=https://twitter.com/yourcompany
SOCIAL_FACEBOOK=
```
### Step 5: Add Deploy Key to Gitea
### Branding Colors
Customize your brand colors:
```bash
cat > /tmp/gitea_deploy_key.json << EOF
PRIMARY_COLOR=#2563EB # Main brand color (buttons, links)
ACCENT_COLOR=#059669 # Success/accent color
DARK_COLOR=#1E293B # Dark elements (footer, headings)
```
Colors update automatically across the entire site!
### About Page Content
```bash
ABOUT_MISSION=Our mission statement here
ABOUT_VISION=Our vision statement here
ABOUT_VALUES=Integrity, Excellence, Innovation, Partnership
```
### Services Offered
```bash
SERVICES_LIST=Executive Search,Contract Staffing,Permanent Placement,Career Consulting
```
### Feature Configuration
```bash
MAX_CV_SIZE_MB=5
ALLOWED_CV_TYPES=application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document
```
## 🤖 AI Agent Modification
This template is designed to be easily modified by AI agents like Claude Code. The structure includes:
### Clear File Organization
```
ai-recruit-site-template/
├── config.js # Centralized configuration
├── server.js # Main application
├── public/
│ ├── js/
│ │ └── init.js # Dynamic config injection
│ ├── css/
│ │ └── styles.css # CSS with variables
│ └── *.html # HTML with data attributes
├── migrations/ # Database migrations
└── .env.example # Configuration template
```
### Data Attributes
HTML elements use data attributes for dynamic content:
```html
<div data-company-name>Your Company</div>
<h1 data-company-tagline>Your Tagline</h1>
<a data-contact-email>email@example.com</a>
```
### Configuration API
Frontend can access configuration via API:
```javascript
// GET /api/config returns:
{
"title": "Coolify Deploy Key",
"key": "$(cat /tmp/recruitai_deploy_key.pub)",
"read_only": true
company: { name, tagline, description },
branding: { primaryColor, accentColor, darkColor },
contact: { email, phone, address, businessHours },
social: { linkedin, twitter, facebook },
about: { mission, vision, values },
services: { list: [...] }
}
EOF
curl -s -X POST "${GITEA_API}/repos/username/ai-recruit-site-template/keys" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d @/tmp/gitea_deploy_key.json
```
### Step 6: Create Coolify Application
## 💻 Local Development
### With Docker (Recommended)
```bash
curl -s -X POST "${COOLIFY_API}/applications/public" \
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"project_uuid": "YOUR_PROJECT_UUID",
"environment_name": "production",
"server_uuid": 0,
"type": "public",
"source": {
"type": "git",
"url": "git@git.startanaicompany.com:username/ai-recruit-site-template",
"branch": "main",
"private_key_uuid": "YOUR_PRIVATE_KEY_UUID"
},
"build_pack": "dockerfile",
"ports_exposes": "3000",
"name": "recruitai"
}'
cp .env.example .env
# Edit .env with your settings
docker-compose up -d
```
### Step 7: Add Webhook to Gitea
Access at: http://localhost:3000
### Without Docker
```bash
curl -s -X POST "${GITEA_API}/repos/username/ai-recruit-site-template/hooks" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"type": "gitea",
"config": {
"url": "https://app.coolify.io/api/v1/deploy?uuid=YOUR_APP_UUID",
"content_type": "json",
"http_method": "GET"
},
"events": ["push"],
"active": true
}'
# Install dependencies
npm install
# Start PostgreSQL (must be running)
# Create database 'recruitment'
# Copy environment file
cp .env.example .env
# Start application
npm start
```
### Step 8: Configure Cloudflare DNS
## 📊 Technology Stack
```bash
curl -s -X POST "${CLOUDFLARE_API}/zones/YOUR_ZONE_ID/dns_records" \
-H "Authorization: Bearer ${CLOUDFLARE_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"type": "CNAME",
"name": "recruitai",
"content": "YOUR_COOLIFY_FQDN",
"ttl": 1,
"proxied": false
}'
```
- **Backend**: Node.js 18 + Express
- **Database**: PostgreSQL 15 with BYTEA for CV storage
- **Authentication**: Session-based with bcrypt
- **File Upload**: Multer (PDF, DOC, DOCX)
- **Deployment**: Docker Compose + Coolify
- **DNS**: Cloudflare
### Step 9: Update Application Domain
## 🔐 Security Features
```bash
curl -s -X PATCH "${COOLIFY_API}/applications/YOUR_APP_UUID" \
-H "Authorization: Bearer ${COOLIFY_TOKEN}" \
-H "Content-Type: application/json" \
-d '{
"domains": "http://recruitai.startanaicompany.com"
}'
```
- Password hashing with bcrypt (10 rounds)
- Secure HTTP-only session cookies
- SQL injection protection (parameterized queries)
- File upload validation (type and size)
- Environment-based secrets
- Automatic HTTPS in production
### Step 10: Deploy
```bash
curl -s -X GET "${COOLIFY_API}/deploy?uuid=YOUR_APP_UUID&force=true" \
-H "Authorization: Bearer ${COOLIFY_TOKEN}"
```
## First Time Setup
### Admin Account
1. Navigate to `/admin/login`
2. On first visit, you'll be prompted to create an admin account
3. Enter your email, password, and full name
4. Click "Create Admin Account"
5. You'll be logged in automatically
### Add Jobs
1. Go to Admin Dashboard → Jobs
2. Click "Create New Job"
3. Fill in job details
4. Click "Save"
## Database Schema
### Tables
- **admins** - Admin user accounts
- **job_postings** - Job listings
- **applicants** - Applicant information
- **applications** - Application submissions with CV storage (BYTEA)
- **contact_submissions** - Contact form messages
### Migrations
Migrations are located in `/migrations/` and run automatically on first Docker startup.
## API Endpoints
## 📚 API Documentation
### Public APIs
- `GET /api/jobs` - List all active jobs
- `GET /api/config` - Get site configuration
- `GET /api/jobs` - List active jobs
- `GET /api/jobs/:id` - Get job details
- `POST /api/apply` - Submit application (multipart/form-data)
- `POST /api/contact` - Submit contact form
@@ -282,89 +276,94 @@ Migrations are located in `/migrations/` and run automatically on first Docker s
- `GET /api/admin/check` - Check auth status
- `POST /api/admin/logout` - Logout
- `GET /api/admin/stats` - Dashboard statistics
- `GET /api/admin/applications` - List applications
- `GET /api/admin/applications` - List applications (with filters)
- `GET /api/admin/applications/:id` - Get application details
- `GET /api/admin/applications/:id/cv` - Download CV
- `PATCH /api/admin/applications/:id` - Update application
- `PATCH /api/admin/applications/:id` - Update application status
- `GET /api/admin/jobs` - List all jobs
- `POST /api/admin/jobs` - Create job
- `PATCH /api/admin/jobs/:id` - Update job
- `DELETE /api/admin/jobs/:id` - Delete job
- `PATCH /api/admin/jobs/:id` - Update job (activate/deactivate)
## Security Features
## 🆘 Troubleshooting
- **Password Hashing** - bcrypt with 10 rounds
- **Session Management** - Secure HTTP-only cookies
- **SQL Injection Protection** - Parameterized queries
- **File Upload Validation** - Type and size checks
- **CSRF Protection** - Session-based authentication
- **Rate Limiting** - (Recommended to add in production)
## Environment Variables
| Variable | Description | Default |
|----------|-------------|---------|
| `DB_HOST` | PostgreSQL host | `postgres` |
| `DB_PORT` | PostgreSQL port | `5432` |
| `DB_NAME` | Database name | `recruitment` |
| `DB_USER` | Database user | `postgres` |
| `DB_PASSWORD` | Database password | `changeme123` |
| `PORT` | Application port | `3000` |
| `NODE_ENV` | Environment | `production` |
| `SESSION_SECRET` | Session encryption key | *(required)* |
## File Upload Limits
- **Max CV Size**: 5MB
- **Allowed Types**: PDF, DOC, DOCX
- **Storage**: PostgreSQL BYTEA column
## Troubleshooting
### Database Connection Issues
### Deployment Issues
```bash
# Check if PostgreSQL is running
docker-compose ps
# Check Coolify logs
# Visit: https://app.coolify.io → Your Application → Logs
# View PostgreSQL logs
# Re-trigger deployment
curl -X POST "https://app.coolify.io/api/v1/applications/YOUR_APP_UUID/restart" \
-H "Authorization: Bearer $COOLIFY_API_TOKEN"
```
### Database Issues
```bash
# Check database connection
docker-compose logs postgres
# Restart PostgreSQL
docker-compose restart postgres
```
### Migration Errors
```bash
# Connect to database
# Access database
docker-compose exec postgres psql -U postgres -d recruitment
# Check tables
# List tables
\dt
# Re-run migrations manually
docker-compose exec postgres psql -U postgres -d recruitment -f /docker-entrypoint-initdb.d/001_init_schema.sql
```
### Application Won't Start
### Configuration Not Updating
```bash
# Check application logs
docker-compose logs app
Make sure you:
1. Updated `.env` file
2. Committed and pushed changes (triggers webhook)
3. Waited 2-3 minutes for redeployment
# Rebuild and restart
docker-compose down
docker-compose build --no-cache
docker-compose up -d
```
## 🎓 First Time Setup
## License
1. Visit your deployment URL
2. Go to `/admin/login`
3. System detects no admin exists
4. Fill in email, password, and full name
5. Click "Create Admin Account"
6. You're logged in!
MIT
## 📝 Environment Variables Reference
## Support
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `COMPANY_NAME` | Your company name | Your Recruitment Firm | Yes |
| `COMPANY_TAGLINE` | Main tagline | Finding the Perfect Match... | Yes |
| `COMPANY_DESCRIPTION` | Company description | We specialize in... | Yes |
| `PRIMARY_COLOR` | Primary brand color | #2563EB | No |
| `ACCENT_COLOR` | Accent color | #059669 | No |
| `DARK_COLOR` | Dark color | #1E293B | No |
| `CONTACT_EMAIL` | Contact email | info@yourcompany.com | Yes |
| `CONTACT_PHONE` | Contact phone | +1 (555) 123-4567 | Yes |
| `CONTACT_ADDRESS` | Physical address | 123 Business St... | Yes |
| `BUSINESS_HOURS` | Business hours | Monday - Friday... | No |
| `SOCIAL_LINKEDIN` | LinkedIn URL | (empty) | No |
| `SOCIAL_TWITTER` | Twitter URL | (empty) | No |
| `SOCIAL_FACEBOOK` | Facebook URL | (empty) | No |
| `SUBDOMAIN` | Your subdomain | yourname | Yes (deploy) |
| `GITEA_USERNAME` | Your Gitea username | - | Yes (deploy) |
| `GITEA_REPO_NAME` | Your repo name | - | Yes (deploy) |
| `DB_PASSWORD` | Database password | (auto-generated) | No |
| `SESSION_SECRET` | Session secret | (auto-generated) | No |
| `MAX_CV_SIZE_MB` | Max CV file size | 5 | No |
| `ALLOWED_CV_TYPES` | Allowed CV MIME types | pdf,doc,docx | No |
For issues or questions, contact: info@ryansrecruit.com
Webhook configured successfully!
# Repository moved to organization
## 🤝 Contributing
This is a template repository. Feel free to:
- Fork it for your own recruitment site
- Customize it to your needs
- Submit improvements via pull request
## 📄 License
MIT License - feel free to use for commercial projects
## 🆘 Support
For issues or questions:
- Check the [How to set up a template repo guide](/home/milko/projects/airepotemplates/How-to-set-up-a-template-repo.md)
- Contact: info@startanaicompany.com