The web challenge of a candidate's journey to greatness.
This is an Express.js application with full TypeScript support for both server-side and client-side code. The project uses Vite for client-side bundling and hot module replacement.
candidate-test/
├── src/
│ ├── server/ # Server-side TypeScript code
│ │ ├── tsconfig.json # Server-side TypeScript config
│ │ ├── restaurants.ts # Server-side array of Restaurants (id & name)
│ │ ├── api.ts # Server-side fetch functions and return type definitions
│ │ └── index.ts # Express server entry point
│ └── client/ # Client-side TypeScript code
│ ├── tsconfig.json # Client-side TypeScript config
│ ├── index.html # Main HTML file
│ ├── styles.css # CSS styles
│ └── main.ts # Client-side TypeScript entry point
├── public/ # Built client-side files (generated by Vite)
├── dist/ # Compiled server-side files (generated by TypeScript)
├── vite.config.ts # Vite configuration
└── package.json # Project dependencies and scripts
- ✅ Express.js server serving static files and API routes
- ✅ Separate TypeScript configurations for server and client code
- ✅ Vite for fast client-side development and building
- ✅ Single command to start development environment
- ✅ Watch mode for both server and client TypeScript files
- ✅ Hot reloading for client-side changes
- ✅ Server restart on server-side changes
npm installStart the development environment with a single command:
npm run devThis command will:
- Start Vite in watch mode to build client-side TypeScript
- Start the Express server with nodemon to watch server-side TypeScript
- Both processes run concurrently and watch for file changes
The server will be available at http://localhost:3000
Build both client and server code:
npm run buildnpm startnpm run dev- Start both client and server in development mode with watchnpm run dev:client- Run only Vite build watcher for client codenpm run dev:server- Run only server with nodemonnpm run build- Build both client and server for productionnpm run build:client- Build only client codenpm run build:server- Compile only server TypeScriptnpm start- Run the production server
To add new API routes, edit src/server/index.ts:
app.get('/api/your-route', (req: Request, res: Response) => {
res.json({ data: 'your data' });
});- Server: Express.js with TypeScript
- Client: Vanilla TypeScript with Vite
- Build Tools: Vite (client), TypeScript Compiler (server)
- Dev Tools: tsx, nodemon, concurrently