feat: bootstrap temporserv project scaffold

Add the initial project blueprint, Go backend skeleton, frontend app shell, database schema draft, and local development/deployment files.
This commit is contained in:
2026-04-02 22:17:48 +03:00
commit 2b3123a9a7
37 changed files with 4863 additions and 0 deletions

66
apps/web/src/lib/api.ts Normal file
View File

@@ -0,0 +1,66 @@
export type User = {
id: string
username: string
isAdmin: boolean
}
export type HomePayload = {
recentAlbums: Array<{
id: string
artistId: string
artistName: string
title: string
year: number
trackCount: number
}>
artists: Array<{
id: string
name: string
albumCount: number
}>
}
export type Track = {
id: string
albumId: string
artistId: string
title: string
artistName: string
albumTitle: string
trackNumber: number
durationSeconds: number
}
const API_BASE = import.meta.env.VITE_API_BASE ?? 'http://localhost:4040'
async function request<T>(path: string, init?: RequestInit): Promise<T> {
const response = await fetch(`${API_BASE}${path}`, {
headers: {
'Content-Type': 'application/json',
...(init?.headers ?? {}),
},
...init,
})
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`)
}
return response.json() as Promise<T>
}
export async function login(username: string, password: string) {
return request<{ token: string; user: User }>('/api/auth/login', {
method: 'POST',
body: JSON.stringify({ username, password }),
})
}
export async function fetchHome() {
return request<HomePayload>('/api/home')
}
export async function fetchTracks() {
return request<{ items: Track[] }>('/api/tracks')
}