Coder Social home page Coder Social logo

go-templ-htmx-template's Introduction

Go + Templ + HTMX + Tailwind CSS Template

Deploy on Railway

๐Ÿš€ Features

โœจ How to use

Prerequisites

Install Taskfile and Air

run npm install

Generating Code

The server binary embeds the static file directory and serves anything contained within under /static. To build the server binary you should first generate the tailwind, templ, and any other necessary generated code for your app:

task generate

Building the binary:

Once all files have been generated, the binary can be built just like any other go binary:

go build -o build/server main.go

Or you can use the build task which will generate code before building the binary:

task build

Containerized Builds

You can easily containerize the build using the provided Dockerfile. Make sure all code is generated before triggering a build of the container, or use the container task which will generate any code first:

task container container_name=my-app container_tag=test

Railway

Deploying to Railway doesn't require any special configuration. You can just fork this repository and configure Railway to use your forked repository. Railway will then automatically build and deploy your main branch on every change. You can click the Deploy to Railway badge at the top of the README to streamline this process.

Note: This template was designed to deploy to Railway in mind but there is nothing prohibiting this template from working elsewhere. The binary is just a standard go http server. The Dockerfile should work just about anywhere the runs containers.

Development Mode

Development mode will watch for changes in the source code and restart the server automatically. It will also watch for changes in the static files and recompile them automatically.

task dev

๐Ÿ“ฆ Structure

static/: static files that are are served directly by the application server at /static/*
templates/: Reusable Templ components
views/: Views and routes for views

go-templ-htmx-template's People

Contributors

bnprtr avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.