Skip to content

kapetan-io/template-web

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Template-Web

A full-stack application with React Native Expo frontend and Go backend using duh-RPC and MongoDB.

Architecture

  • Frontend: React Native with Expo, TypeScript, NativeWind (Tailwind CSS)
  • Backend: Go with duh-RPC, layered architecture (transport/service/store)
  • Database: MongoDB with Docker
  • Authentication: Simple username-only authentication with session tokens

Project Structure

template-web/
├── frontend/              # Expo React Native + Web app
├── backend/               # Go backend with layered architecture
│   ├── cmd/template-web/  # Application entry point
│   ├── transport/         # RPC definitions, HTTP handlers
│   ├── store/             # MongoDB repository pattern
│   ├── service.go         # Business logic methods
│   └── client.go          # Go client for duh-RPC endpoints
├── docker-compose.yml     # MongoDB + backend services
└── README.md              # This file

Getting Started

Prerequisites

  • Node.js 18+ and npm
  • Go 1.21+
  • Docker and Docker Compose

Backend Setup

  1. Start MongoDB and backend services:
docker-compose up -d
  1. Or run backend locally:
cd backend
go mod tidy
go run cmd/backend/main.go

Frontend Setup

  1. Install dependencies:
cd frontend
npm install
  1. Start development server:
# For web
npm run web

# For iOS (requires macOS and Xcode)
npm run ios

# For Android (requires Android Studio)
npm run android

API Endpoints

The backend uses duh-RPC with the following endpoints:

  • POST /v1/users.create - Create a new user account
  • POST /v1/users.login - Login with username
  • POST /v1/users.get - Get user information

Environment Variables

Backend

  • MONGO_URI - MongoDB connection string (default: mongodb://localhost:27017)
  • DB_NAME - Database name (default: template-web)
  • SERVER_ADDR - Server address (default: :8080)

Development

Backend Development

  • The backend follows a layered architecture pattern inspired by querator
  • Transport layer handles HTTP/RPC
  • Service layer contains business logic
  • Store layer handles database operations

Frontend Development

  • Uses Expo Router for navigation
  • NativeWind for styling (Tailwind CSS for React Native)
  • TypeScript for type safety
  • Mobile-first design with web support

About

Template for web applications with a type script frontend and a duh-rpc golang backend.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published