Client Projects
Smart Work Core
Environment intelligence hub: public data from Colombia turned into alerts with a readable rule.
- Next.js
- Rule engine
- AI assistant
- Open data
- Hexagonal architecture
- Cloudflare Access


- Role
- Lead full stack developer
- Period
- Oct 2026 – Present
- Team
Jorge Velásquez · Creó el repositorio inicial
Stack
- Frontend
- Next.js 16React 19Tailwind CSS 4Zustand 5TanStack Query 5Recharts 3
- Backend
- TypeScript 6Zod 4jose 6
- AI
- Vercel AI SDK 7OpenAI APIOpenRouter
- Infrastructure
- VercelCloudflare AccessDockerGitHub Actions
- Testing
- Vitest 5Playwright 1.64
- Tooling
- pnpm 11
The problem
The dollar, public contracts, competitors, news and regulation live in different sources. They rarely explain what a change means for a specific company, and checking them by hand every day does not scale.
What I built
Smart Work Core started as a university commission for a client who prefers to stay anonymous. Jorge Velásquez created the initial repository. I designed and built the product, including the Next.js application.
- Alert radar. Each signal has a severity (informative, watch or alert), the rule that produced it and a link to the original source. It can be marked new, reviewed or dismissed.
- Rule engine. Pure TypeScript functions that check the daily TRM (the official COP/USD rate) move, contracts about to expire, new competitor contracts, the energy price, and keyword mentions in news and regulation. The user adjusts the thresholds.
- PESTEL, a decision log and a weekly briefing that exports to Markdown and CSV.
- Several companies, each with its own profile, competitors and keywords. An AI-guided onboarding drafts the initial profile.
- AI assistant that answers about the data already loaded, using eight read-only tools.
Data comes from datos.gov.co (TRM, SECOP II contracts, Supersociedades reports), the World Bank, XM and RSS feeds from Colombian media.
Results
- A complete application with radar, PESTEL, briefing, assistant and multi-company management.
- Access restricted by Cloudflare Access, with JWT validation inside the application itself.
- An architecture that checks itself: a test fails if the rule core depends on infrastructure.
I do not publish usage metrics: the tool has restricted access and I have no verifiable figures.
How it is used
- Step 1
User · Signs in with an account authorized by Cloudflare Access
- Step 2
Onboarding assistant · Drafts the company profile from what the user describes
- Step 3
System · Queries the public sources and applies the rules
Every alert keeps its rule and its source
- Step 4
User · Reviews alerts, dismisses irrelevant ones and logs a decision
- Step 5
AI assistant · Answers questions with read-only tools
- Step 6
User · Exports the weekly briefing
Markdown, CSV or print
Architecture
Public sources
- datos.gov.coType: externalTRM, SECOP II
- World BankType: external
- XMType: externalEnergy price
- Media RSSType: external
Application
- Rule engineType: servicesrc/core
- InterfaceType: clientNext.js
- AI assistantType: aiVercel AI SDK
Access
- Cloudflare AccessType: infra
Connections
- datos.gov.coRule engine
- World BankRule engine
- XMRule engine
- Media RSSRule engine
- Rule engineInterfacealerts
- AI assistantRule enginetools
- Cloudflare AccessInterfaceJWT
Architecture
A Next.js 16 (App Router) application with no database: each company’s state lives in the browser with Zustand. The code follows a hexagonal architecture. src/core is pure TypeScript (rules, PESTEL, briefing, onboarding) and defines ports such as source-adapter, signal-analyzer, clock and logger. src/infrastructure implements those ports with the data sources and the AI. src/features/* groups the interface by domain.
Sources
- datos.gov.coType: externalTRM, SECOP II, Supersociedades
- World BankType: external
- XMType: external
- RSS and decreesType: external
Infrastructure
- AdaptersType: servicesrc/infrastructure
- AssistantType: aiVercel AI SDK
Core
- Rules and analysisType: servicesrc/core, pure TS
Interface
- Next.js 16Type: clientsrc/features
- Local stateType: dataZustand
- Cloudflare AccessType: infraJWT RS256
Connections
- datos.gov.coAdapters
- World BankAdapters
- XMAdapters
- RSS and decreesAdapters
- AdaptersRules and analysisports
- Rules and analysisNext.js 16alerts
- AssistantRules and analysis8 tools
- Next.js 16Local state
- Cloudflare AccessNext.js 16
Data flow
- Step 1
Adapters · Request data from each source and normalize it
TRM, contracts, macro series, energy, RSS, decrees
- Step 2
Rule engine · Evaluates each rule against the company's thresholds
TRM, expiring contracts, competitors, energy, keywords
- Step 3
Core · Deduplicates, assigns severity and groups by PESTEL
- Step 4
Interface · Shows the alert with its rule and a link to the source
- Step 5
AI assistant · Calls the read tools and streams the answer
External data is treated as untrusted
Repository structure
- src/
- app/: Next.js routes: (app), (account), /api
- core/: pure domain, no infrastructure dependencies
- rules/: TRM, contract, energy and news rules
- onboarding/: company profile
- infrastructure/
- sources/: datos.gov.co, World Bank, XM, RSS
- ai/: model, tools, onboarding
- features/: radar, pestel, briefing, assistant, sources
- proxy.ts: Cloudflare Access JWT validation
- docs/: deployment and Cloudflare Access
- odd/
- tasks/: per-feature documents
Stack
Frontend
- Next.js16
- React19
- Tailwind CSS4
- Zustand5
- TanStack Query5
- Recharts3
Backend
- TypeScript6
- Zod4
- jose6
AI
- Vercel AI SDK7
- OpenAI API
- OpenRouter
Infra
- Vercel
- Cloudflare Access
- Docker
- GitHub Actions
Testing
- Vitest5
- Playwright1.64
Tooling
- pnpm11
Key decisions
- A hexagonal core enforced by a test. An architecture test fails if
src/coreimports infrastructure. Rules can be tested without a network, and a source can change without touching them. - Readable rules as pure functions. Each rule (daily TRM move, expiring contract, new competitor contract, weekly energy change, keyword in news or regulation) is a small function with an adjustable threshold. An alert always shows which rule produced it.
- No database. Each company’s profile is stored in the browser. This reduces the data surface and the operating cost, at the price of state not being shared across devices.
- A read-only assistant, not RAG. Eight tools (
get_trm,get_secop_contracts,get_competitor_financials,get_macro_series,get_news,get_regulation,get_energy_price,detect_signals) query live data. There are no embeddings and no vector store. The system prompt treats external content as untrusted to resist instruction injection. - A model with a fallback. OpenAI
gpt-4.1-miniby default and OpenRouter as the alternative. Without a key the app keeps working and the assistant says it is not configured. - Security at the edge and in the app. Cloudflare Access with Google sign-in protects everything except the landing page. The app also validates the JWT (RS256,
jose) and answers 503 if the configuration is missing. Headers include CSP in report-only mode and HSTS.
Testing, CI and deployment
- Vitest with 181 test files and Testing Library. Playwright covers the assistant, settings, the landing page and a smoke path.
- GitHub Actions runs continuous integration. Linting with oxlint.
- Deployment on Vercel on every push to
main, and a multi-stage Dockerfile (standalone output, non-root user) for the client’s production environment. - The repository is not linked here because it identifies the client.