c0py: initial scaffolding for website registry tool
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
{
|
||||
"name": "@siax/c0py-api",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "tsx watch src/index.ts",
|
||||
"start": "NODE_ENV=production tsx src/index.ts",
|
||||
"build": "tsc",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"@siax/c0py-core": "workspace:*",
|
||||
"@siax/c0py-config": "workspace:*",
|
||||
"@siax/c0py-types": "workspace:*",
|
||||
"fastify": "^5.12.0",
|
||||
"zod": "^3.24.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.0",
|
||||
"tsx": "^4.21.0",
|
||||
"typescript": "^5.7.2",
|
||||
"vitest": "^3.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
import { envSchema } from "@siax/c0py-config";
|
||||
|
||||
export type Env = typeof envSchema;
|
||||
export { envSchema };
|
||||
@@ -0,0 +1,53 @@
|
||||
import Fastify from "fastify";
|
||||
import { envSchema } from "@siax/c0py-config";
|
||||
|
||||
async function main() {
|
||||
const env = envSchema.parse(process.env);
|
||||
|
||||
const server = Fastify({ logger: true });
|
||||
|
||||
server.get("/health", async () => ({
|
||||
status: "ok",
|
||||
timestamp: new Date().toISOString(),
|
||||
}));
|
||||
|
||||
server.get("/", async () => ({
|
||||
name: "c0py",
|
||||
version: "0.1.0",
|
||||
status: "running",
|
||||
}));
|
||||
|
||||
// Registry endpoints
|
||||
server.get("/v1/c0py/registries", async () => {
|
||||
return { registries: [] };
|
||||
});
|
||||
|
||||
server.post("/v1/c0py/registries", async (request) => {
|
||||
const body = (request.body as Record<string, unknown>) ?? {};
|
||||
return { created: body };
|
||||
});
|
||||
|
||||
server.get("/v1/c0py/registries/:id", async (request) => {
|
||||
const { id } = request.params as Record<string, string>;
|
||||
return { id };
|
||||
});
|
||||
|
||||
// Scan endpoints
|
||||
server.post("/v1/c0py/scans", async (request) => {
|
||||
const body = (request.body as Record<string, unknown>) ?? {};
|
||||
return { scanId: "scan-" + Date.now(), created: body };
|
||||
});
|
||||
|
||||
server.get("/v1/c0py/scans/:id", async (request) => {
|
||||
const { id } = request.params as Record<string, string>;
|
||||
return { id };
|
||||
});
|
||||
|
||||
await server.listen({ port: env.PORT, host: "0.0.0.0" });
|
||||
console.log(`c0py API listening on port ${env.PORT}`);
|
||||
}
|
||||
|
||||
main().catch((err) => {
|
||||
console.error(err);
|
||||
process.exit(1);
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
testTimeout: 10000,
|
||||
@@ -0,0 +1,24 @@
|
||||
# C0PY API -- tsconfig.json
|
||||
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2022",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "bundler",
|
||||
"strict": true,
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
"isolatedModules": true,
|
||||
"noEmit": true,
|
||||
"baseUrl": ".",
|
||||
"paths": {
|
||||
"@siax/c0py-config": ["../packages/config/src/index.ts"],
|
||||
"@siax/c0py-core": ["../packages/c0py-core/src/index.ts"],
|
||||
"@siax/c0py-types": ["../packages/types/src/index.ts"]
|
||||
}
|
||||
},
|
||||
"include": ["src/**/*"],
|
||||
"exclude": ["node_modules"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{"type": "vitest"}
|
||||
@@ -0,0 +1,5 @@
|
||||
next.config.js
|
||||
node_modules
|
||||
.next
|
||||
out
|
||||
dist
|
||||
@@ -0,0 +1,8 @@
|
||||
import type { NextConfig } from "next";
|
||||
|
||||
const nextConfig: NextConfig = {
|
||||
output: "standalone",
|
||||
images: { unoptimized: true },
|
||||
};
|
||||
|
||||
export default nextConfig;
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"name": "@siax/c0py-web",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"test": "vitest run"
|
||||
},
|
||||
"dependencies": {
|
||||
"next": "^15.0.0",
|
||||
"react": "^19.0.0",
|
||||
"react-dom": "^19.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^24.0.0",
|
||||
"@types/react": "^19.0.0",
|
||||
"@types/react-dom": "^19.0.0",
|
||||
"typescript": "^5.7.2",
|
||||
"vitest": "^3.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
// Placeholder - Next.js app router entry
|
||||
export default function Home() {
|
||||
return <div>c0py</div>;
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/// <reference types="next" />
|
||||
/// <reference types="next/image-types/global" />
|
||||
|
||||
// NEXT_PUBLIC_* prefixed env vars are inlined at build time
|
||||
// No secret values should use NEXT_PUBLIC_ prefix
|
||||
@@ -0,0 +1 @@
|
||||
{"compilerOptions": {"target": "ES2022", "module": "ESNext", "moduleResolution": "bundler", "jsx": "preserve", "strict": true, "esModuleInterop": true, "skipLibCheck": true, "forceConsistentCasingInFileNames": true, "resolveJsonModule": true, "isolatedModules": true, "noEmit": true, "baseUrl": ".", "paths": {"@siax/c0py-core": ["../../packages/c0py-core/src/index.ts"], "@siax/c0py-config": ["../../packages/config/src/index.ts"], "@siax/c0py-types": ["../../packages/types/src/index.ts"]}}, "include": ["."], "exclude": ["node_modules", ".next"]}
|
||||
Reference in New Issue
Block a user