Skip to content

Prekols-Inc/Markdown-editor

Repository files navigation

Markdown Editor

app_demo

Project requirements: requirements.md

Build

Run using Docker Compose

The most easiest way to set up the project is Docker Compose:

  1. Create .env file like .env.example
  2. Generate TLS certificates for backend and auth services and frontend:
for svc in backend auth frontend gigachat_proxy; do
  mkdir -p "$svc/tls"
  openssl req -x509 -newkey rsa:4096 -sha256 -days 365 -nodes \
    -subj "/CN=localhost" \
    -keyout "$svc/tls/key.crt" \
    -out "$svc/tls/cert_${svc}.crt"
done
  1. Go to https://localhost:<AUTH_PORT>/health. You`ll see "Your connection not private". Click Advanced > proceed to localhost. Repeat for backend
  2. Run project:
  • To run all containers in a background (detach process)
docker-compose up -d
  • To attach all processes to the terminal session
docker compose up

Build from source

Frontend

Prerequisites: Node.js ≥ 18 LTS and npm (or pnpm / yarn).

# 1. Go to the frontend folder
cd frontend

# 2. Install dependencies
npm install

# 3. Add env variables in frontend/.env file:
# Example: 
VITE_AUTH_API_BASE_URL=https://localhost:8080
VITE_STORAGE_API_BASE_URL=https://localhost:1234

# 4. Start the dev server
npm run dev

Admin credentials:

  • Username: admin
  • Password: password

Project overview

Overview

Backend

  1. Create JWT_SECRET in .env file
  2. Generate TLS certificate (see «Run using Docker Compose»)
  3. Run:
cd backend
go mod tidy
go run . --host=localhost --port=YOUR_PORT

Auth service

Prerequisites: Go ≥ 1.23, PostgreSQL.

  1. Create JWT_SECRET in .env file
  2. Generate TLS certificate (see «Run using Docker Compose»)
  3. Run PostgreSQL instance:
cd auth
sudo apt install posgtresql
sudo -u postgres createdb auth_db # creates database
sudo -u postgres psql -d auth_db -f db/init.sql # creates table 'users'
  1. Run:
export DB_ variables # env variables from .env.example
go mod tidy
go run . --host=localhost --port=YOUR_PORT

Swagger

Requirements:

  • swag utility Install it using:
$ go install github.com/swaggo/swag/cmd/swag@latest
# swag must be in $GOPATH/bin

Docs generation:

  1. To generate documentation run:
cd backend
swag init
cd ../auth
swag init
  1. To use see http://localhost:YOUR_PORT/swagger/index.html for auth and backend

Tests

Frontend

cd frontend
npm run test

Backend

  1. Create backend/.env file like backend/.env.example
  2. Run:
cd backend
go test  -v

Auth service

cd auth
go test -v

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 7