Skip to content

This repository contains a frontend made with vue/vite and typescript as well as a backend made with a simple express API and postgress db access.

License

Notifications You must be signed in to change notification settings

kraibse/vite-typeorm-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vite-TypeORM-Template

This repository contains a full-stack application template with a frontend built using Vue 3, Vite, and TypeScript, and a backend using Express and TypeORM with PostgreSQL database access.

Table of Contents

Project Structure

vite-typeorm-template/
├── express-backend/
│   ├── src/
│   │   ├── entities/
│   │   │   └── user.ts
│   │   └── main.ts
│   ├── package.json
│   └── ormconfig.json
└── vite-frontend/
    ├── src/
    ├── package.json
    └── README.md

Frontend

The frontend is developed using Vue 3, Vite, and TypeScript. It provides a modern setup for building reactive user interfaces.

Features

  • Vue 3 with Single File Components (SFCs)
  • TypeScript for static typing
  • Vite for fast development and build

Setup

Refer to the Vue Docs TypeScript Guide for recommended project setup and IDE support.

Backend

The backend is a simple Express API that connects to a PostgreSQL database using TypeORM.

Features

  • Express for handling HTTP requests
  • TypeORM for database interaction
  • PostgreSQL as the database

Configuration

The database connection is configured in ormconfig.json:

{
    "type": "postgres",
    "host": "localhost",
    "port": 5432,
    "username": "postgres",
    "password": "postgres",
    "database": "dev",
    "entities": ["src/entities/*.ts"],
    "synchronize": true
}

API Endpoints

  • GET /users: Retrieve all users
  • POST /users: Add a new user

Getting Started

Prerequisites

  • Node.js and npm
  • PostgreSQL

Installation

  1. Clone the repository:

    git clone https://github.com/yourusername/vite-typeorm-template.git
    cd vite-typeorm-template
  2. Install dependencies for both frontend and backend:

    cd express-backend
    npm install
    cd ../vite-frontend
    npm install
  3. Set up the database:

    Ensure PostgreSQL is running and a database named dev is created.

  4. Run the backend:

    cd express-backend
    pnpx tsx src/main.ts
  5. Run the frontend:

    cd vite-frontend
    npm run dev

Scripts

Backend

  • npm start: Start the Express server
  • npm test: Run tests (not specified)

Frontend

  • npm run dev: Start the Vite development server
  • npm run build: Build the frontend for production

License

This project is licensed under the MIT License.

About

This repository contains a frontend made with vue/vite and typescript as well as a backend made with a simple express API and postgress db access.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published