Skip to content

Example Buffalo codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.

Notifications You must be signed in to change notification settings

toptechskills/gobuff_realworld_example_app

 
 

Repository files navigation

RealWorld Example App

This codebase was created to demonstrate a fully fledged fullstack application built with Buffalo including CRUD operations, authentication, routing, pagination, and more.

We've gone to great lengths to adhere to the Buffalo community styleguides & best practices.

For more information on how to this works with other frontends/backends, head over to the RealWorld repo.

Getting started

1. Prepare the database

Make sure PostgresQL is installed and running locally, then set up a database with configuration matching database.yml.

Or start a postgres container locally:

docker run --name rw_db -e POSTGRES_DB=gobuff_realworld_example_app_development -e POSTGRES_PASSWORD=postgres -e POSTGRES_USER=postgres -p 5432:5432 -d postgres

2. Install app dependencies

Golang

# apt (e.g. Ubuntu)
sudo apt update
sudo apt install golang

For other platforms see: https://go.dev/doc/install

Buffalo

See the Buffalo docs: Install Buffalo

buffalo-pop (for database migrations)

go install github.com/gobuffalo/buffalo-pop/v3@3.0.7

3. Run the migrations

buffalo pop migrate

4. Start the app

buffalo dev

If you point your browser to http://127.0.0.1:3000 you should see the home page.

Running the tests

buffalo test --force-migrations
buffalo test models -m "ArticleFavorite" --force-migrations

How it works

Buffalo web application with server side rendering, server side user session and PostgreSQL database.

Authentication

Authentication is generated by Auth Generator for Buffalo.

Pagination of Articles

Uses pop's paginator as described in Pagination.

About

Example Buffalo codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the RealWorld API spec.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Go 57.7%
  • HTML 41.2%
  • Dockerfile 1.1%