memos/docs/development-windows.md
Lincoln Nogueira 3b76c6792c
feat: add preliminar Windows support (#1636)
Add preliminar Windows support for both
development and production environments.

Default profile.Data will be set to "C:\ProgramData\memos" on Windows.
Folder will be created if it does not exist, as this behavior is
expected for Windows applications.

System service installation can be achieved with third-party tools,
explained in docs/windows-service.md.

Not sure if it's worth using https://github.com/kardianos/service
to make service support built-in.

This could be a nice addition alongside #1583 (add Windows artifacts)
2023-05-09 08:16:38 +08:00

2.4 KiB

Development

Memos is built with a curated tech stack. It is optimized for developer experience and is very easy to start working on the code:

  1. It has no external dependency.
  2. It requires zero config.
  3. 1 command to start backend and 1 command to start frontend, both with live reload support.

Tech Stack

Frontend Backend
React Go
Tailwind CSS SQLite
Vite
pnpm

Prerequisites

Steps

(Using PowerShell)

  1. pull source code

    git clone https://github.com/usememos/memos
    # or
    gh repo clone usememos/memos
    
  2. cd into the project root directory

    cd memos
    
  3. start backend using air (with live reload)

    air -c .\scripts\.air-windows.toml
    
  4. start frontend dev server

    cd web; pnpm i; pnpm dev
    

Memos should now be running at http://localhost:3001 and changing either frontend or backend code would trigger live reload.

Building

Frontend must be built before backend. The built frontend must be placed in the backend ./server/dist directory. Otherwise, you will get a "No frontend embeded" error.

Frontend

Move-Item "./server/dist" "./server/dist.bak"
cd web; pnpm i --frozen-lockfile; pnpm build; cd ..;
Move-Item "./web/dist" "./server/" -Force

Backend

go build -o ./build/memos.exe ./main.go

Notes

  • Start development servers easier by running the provided start.ps1 script. This will start both backend and frontend in detached PowerShell windows:

    .\scripts\start.ps1
    
  • Produce a local build easier using the provided build.ps1 script to build both frontend and backend:

    .\scripts\build.ps1
    

    This will produce a memos.exe file in the ./build directory.