Initial implementation of Website Change Detection Monitor MVP

Features implemented:
- Backend API with Express + TypeScript
- User authentication (register/login with JWT)
- Monitor CRUD operations with plan-based limits
- Automated change detection engine
- Email alert system
- Frontend with Next.js + TypeScript
- Dashboard with monitor management
- Login/register pages
- Monitor history viewer
- PostgreSQL database schema
- Docker setup for local development

Technical stack:
- Backend: Express, TypeScript, PostgreSQL, Redis (ready)
- Frontend: Next.js 14, React Query, Tailwind CSS
- Database: PostgreSQL with migrations
- Services: Page fetching, diff detection, email alerts

Documentation:
- README with full setup instructions
- SETUP guide for quick start
- PROJECT_STATUS with current capabilities
- Complete technical specifications

Ready for local testing and feature expansion.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Timo
2026-01-16 18:46:40 +01:00
commit 2c1ec69a79
45 changed files with 5941 additions and 0 deletions

90
frontend/lib/api.ts Normal file
View File

@@ -0,0 +1,90 @@
import axios from 'axios';
const API_URL = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:3001';
export const api = axios.create({
baseURL: `${API_URL}/api`,
headers: {
'Content-Type': 'application/json',
},
});
// Add auth token to requests
api.interceptors.request.use((config) => {
const token = localStorage.getItem('token');
if (token) {
config.headers.Authorization = `Bearer ${token}`;
}
return config;
});
// Handle auth errors
api.interceptors.response.use(
(response) => response,
(error) => {
if (error.response?.status === 401) {
localStorage.removeItem('token');
localStorage.removeItem('user');
window.location.href = '/login';
}
return Promise.reject(error);
}
);
// Auth API
export const authAPI = {
register: async (email: string, password: string) => {
const response = await api.post('/auth/register', { email, password });
return response.data;
},
login: async (email: string, password: string) => {
const response = await api.post('/auth/login', { email, password });
return response.data;
},
};
// Monitor API
export const monitorAPI = {
list: async () => {
const response = await api.get('/monitors');
return response.data;
},
get: async (id: string) => {
const response = await api.get(`/monitors/${id}`);
return response.data;
},
create: async (data: any) => {
const response = await api.post('/monitors', data);
return response.data;
},
update: async (id: string, data: any) => {
const response = await api.put(`/monitors/${id}`, data);
return response.data;
},
delete: async (id: string) => {
const response = await api.delete(`/monitors/${id}`);
return response.data;
},
check: async (id: string) => {
const response = await api.post(`/monitors/${id}/check`);
return response.data;
},
history: async (id: string, limit = 50) => {
const response = await api.get(`/monitors/${id}/history`, {
params: { limit },
});
return response.data;
},
snapshot: async (id: string, snapshotId: string) => {
const response = await api.get(`/monitors/${id}/history/${snapshotId}`);
return response.data;
},
};

29
frontend/lib/auth.ts Normal file
View File

@@ -0,0 +1,29 @@
export function saveAuth(token: string, user: any) {
localStorage.setItem('token', token);
localStorage.setItem('user', JSON.stringify(user));
}
export function getAuth() {
if (typeof window === 'undefined') return null;
const token = localStorage.getItem('token');
const userStr = localStorage.getItem('user');
if (!token || !userStr) return null;
try {
const user = JSON.parse(userStr);
return { token, user };
} catch {
return null;
}
}
export function clearAuth() {
localStorage.removeItem('token');
localStorage.removeItem('user');
}
export function isAuthenticated() {
return !!getAuth();
}