A complete tutorial project demonstrating how to build a Vue.js application with Vite and Deno, featuring a full-stack TypeScript setup with a Deno backend.
You can deploy your own version of this Vue app to Deno Deploy immediately. Just click the button to clone and deploy.
This project showcases how to:
- Build a Vue.js frontend with Vite and TypeScript
- Create a Deno backend API using Oak framework
- Serve both development and production builds
- Deploy to Deno Deploy
The app is a simple dinosaur explorer that displays a list of dinosaurs and shows detailed information when you click on one.
βββ api/ # Deno backend server
β βββ main.ts # Main server file with API routes
β βββ data.json # Sample dinosaur data
β βββ util/ # Server utilities
βββ src/ # Vue.js frontend source
β βββ components/ # Vue components
β βββ router/ # Vue Router configuration
β βββ main.ts # App entry point
βββ public/ # Static assets
βββ dist/ # Built frontend (generated)
βββ deno.json # Deno configuration and imports
βββ package.json # NPM dependencies for Vite
βββ vite.config.ts # Vite configuration
- Deno installed on your machine
- Basic knowledge of Vue.js and TypeScript
-
Clone or download this project
-
Install Deno (if not already installed):
curl -fsSL https://deno.land/install.sh | sh
On Windows, you can use PowerShell:
irm https://deno.land/install.ps1 | iex
-
Install dependencies:
deno install
npm run dev
This command starts:
- Deno API server on
http://localhost:8000
(Oak + TypeScript) - Vite dev server on
http://localhost:3000
(Vue.js with HMR)
The Vite server automatically proxies API requests to the Deno server.
# API server only
npm run dev:api
# Vite dev server only
npm run dev:vite
npm run build
This creates an optimized build in the dist/
directory.
npm run serve
This builds the app and serves everything from the Deno server on http://localhost:8000
.
- β Vue 3 with Composition API
- β TypeScript support
- β Vue Router for client-side routing
- β Hot Module Replacement (HMR)
- β Optimized production builds
- β TypeScript-first development
- β Oak framework for HTTP server
- β CORS support for development
- β Static file serving for production
- β JSON API endpoints
- β API proxy during development
- β
Automatic server restart with
--watch
- β Single command to start everything
- β Production-ready build process
GET /api/dinosaurs
- Get all dinosaursGET /api/dinosaurs/:name
- Get specific dinosaur by name
Defines Deno imports and tasks:
{
"imports": {
"@oak/oak": "jsr:@oak/oak@^17.1.5",
"@tajpouria/cors": "jsr:@tajpouria/cors@^1.2.1",
"vue-router": "npm:vue-router@^4.5.1"
}
}
Configures Vite with Deno plugin and API proxy:
export default defineConfig({
server: {
proxy: {
"/api": "http://localhost:8000"
}
},
plugins: [vue(), deno()]
});
-
Push your code to GitHub
-
Connect to Deno Deploy:
- Go to dash.deno.com
- Create a new project
- Connect your GitHub repository
-
Configure the deployment:
- Entry point:
api/main.ts
- Build command:
npm run build
- The built Vue app will be served alongside the API
- Entry point:
-
Environment variables (if needed):
- Set any required environment variables in the Deno Deploy dashboard
This project is part of a comprehensive tutorial. You can follow along with the complete tutorial at: Deno Docs - Vue.js Tutorial