A modern web application frontend built with SvelteKit and TypeScript, designed to work with a Rust Axum backend API. The API is taken from axum-backend (Vibe coded)
http://localhost:3000
Install dependencies:
npm install
Start the development server:
npm run dev
# or start and open in browser
npm run dev -- --open
Access the application:
Open your browser and navigate to http://localhost:5173
src/
āāā lib/ # Shared libraries and components
ā āāā api.ts # API functions for backend communication
ā āāā types.ts # TypeScript type definitions
ā āāā styles.css # Global styles
ā āāā components/ # Reusable Svelte components
ā ā āāā UserForm.svelte
ā ā āāā UserList.svelte
ā āāā index.ts # Library exports
āāā routes/ # SvelteKit routes
ā āāā +page.svelte # Main application page
āāā app.html # HTML template
āāā app.d.ts # TypeScript declarations
Command | Description |
---|---|
npm run dev |
Start development server with hot reload |
npm run build |
Build for production |
npm run preview |
Preview production build locally |
npm run check |
Run TypeScript and Svelte type checking |
npm run check:watch |
Run type checking in watch mode |
The app is configured to communicate with a backend API at http://localhost:3000/api
. Make sure your Rust Axum server is running on port 3000.
src/lib/components/
src/lib/api.ts
src/lib/types.ts
src/lib/styles.css
Create production build:
npm run build
Preview the build:
npm run preview
The production build will be optimized and ready for deployment in the build/
directory.
To deploy your app, you may need to install an adapter for your target environment:
@sveltejs/adapter-static
@sveltejs/adapter-node
@sveltejs/adapter-vercel
@sveltejs/adapter-netlify
This frontend is designed to work with a Rust Axum backend that provides:
GET /api/hello
- Welcome messageGET /api/users
- List all usersPOST /api/users
- Create a new userMake sure your backend server implements these endpoints and handles CORS appropriately.
npm run check
to identify TypeScript issuesnpm run check:watch
during development for real-time type checking