Skip to content

A Laravel starter kit with Usersau OAuth integration, built with traditional Blade templates and Tailwind CSS.

Notifications You must be signed in to change notification settings

Users-au/laravel-starter-kit

Repository files navigation

Laravel Usersau Starter Kit (Blade Templates)

A Laravel starter kit with Usersau OAuth integration, built with traditional Blade templates and Tailwind CSS.

Features

  • πŸ” Usersau OAuth Authentication - Complete OAuth integration with Usersau
  • 🎨 Modern UI - Built with Tailwind CSS and Alpine.js
  • πŸ“„ Blade Templates - Traditional server-side rendering with Laravel's Blade engine
  • πŸ›‘οΈ Laravel Sanctum - API authentication support
  • πŸ“± Responsive Design - Mobile-first responsive design
  • ⚑ Alpine.js - Lightweight JavaScript framework for interactive components

Requirements

  • PHP 8.1 or higher
  • Composer
  • Node.js & NPM
  • MySQL/PostgreSQL database

Installation

  1. Clone the repository
    git clone https://github.com/Users-au/laravel-starter-kit.git
    cd laravel-usersau-starter-kit

Automatic installation steps:

Run the installation script

bash ./install.sh

This script will:

  • Install PHP dependencies using Composer
  • Install Node.js dependencies and build assets
  • Set up the environment file

Note: Ensure you have bash installed on your system to run the script.

Manual installation steps:

  1. Install PHP dependencies

    composer install
  2. Install Node.js dependencies

    npm install
    npm run build
    # or for development
    npm run dev
  3. Environment setup

    cp env.example .env
    php artisan key:generate

Database Setup

  1. Set up the database

    • Create a new database in MySQL
    • Update your .env file with the database connection details:
    DB_CONNECTION=mysql
    DB_HOST=127.0.0.1
    DB_PORT=3306
    DB_DATABASE=laravel
    DB_USERNAME=root
    DB_PASSWORD=   
  2. Run database migrations

    php artisan migrate
  3. Start the development server

    php artisan serve

Usersau OAuth Setup

1. Register Your Application

  1. Go to Usersau Developer Console
  2. Go to / Create a new Project and go to Integration > OAuth Management
  3. Create a new OAuth application, fill in the redirect URI as: http://localhost:8000/auth/usersau/callback
  4. View your application details and copy the Client ID and Client Secret.

2. Configure Environment Variables

Add the following to your .env file:

USERSAU_CLIENT_ID=your_client_id_here
USERSAU_CLIENT_SECRET=your_client_secret_here
USERSAU_REDIRECT_URI=http://localhost:8000/auth/usersau/callback
USERSAU_HOST=https://your-subdomain.users.au

Visit

After completing the setup, you can visit your application at http://localhost:8000 to see the login page.

Usage

Available Routes

The following routes are automatically registered by the Usersau package:

  • usersau.login - Redirect to Usersau for authentication
  • usersau.register - Redirect to Usersau for registration
  • usersau.logout - Logout from Usersau
  • usersau.account - Redirect to Usersau account management
  • Callback route - Handles OAuth callback from Usersau

Authentication Flow

  1. Users click "Sign in with Usersau" on the login page
  2. They are redirected to Usersau for authentication
  3. After successful authentication, they are redirected back to your app
  4. User data is automatically synced with your local database

User Model

The User model includes the following Usersau-related fields:

  • usersau_id - Usersau user ID
  • usersau_access_token - OAuth access token
  • usersau_refresh_token - OAuth refresh token

Customization

Redirect URLs

You can customize redirect URLs in config/usersau.php:

return [
    'after_login_url' => '/dashboard',
    'after_logout_url' => '/',
    'after_register_url' => '/welcome',
    // ...
];

Blade Components

The starter kit includes reusable Blade components:

  • <x-authentication-card> - Authentication wrapper
  • <x-application-logo> - Application logo component

Adding Interactive Features

Use Alpine.js for simple interactions:

<div x-data="{ open: false }">
    <button @click="open = !open">Toggle</button>
    <div x-show="open">Content</div>
</div>

File Structure

laravel-starter-kit/
β”œβ”€β”€ app/
β”‚   └── Models/
β”‚       └── User.php                 # User model with Usersau fields
β”œβ”€β”€ config/
β”‚   β”œβ”€β”€ services.php                 # Usersau OAuth configuration
β”‚   └── usersau.php                  # Usersau package configuration
β”œβ”€β”€ database/
β”‚   └── migrations/
β”‚       └── *_add_usersau_columns_to_users_table.php
β”œβ”€β”€ resources/
β”‚   β”œβ”€β”€ views/
β”‚   β”‚   β”œβ”€β”€ layouts/
β”‚   β”‚   β”‚   β”œβ”€β”€ app.blade.php        # Main layout
β”‚   β”‚   β”‚   └── navigation.blade.php # Navigation layout
β”‚   β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”‚   β”œβ”€β”€ authentication-card.blade.php
β”‚   β”‚   β”‚   └── application-logo.blade.php
β”‚   β”‚   β”œβ”€β”€ auth/
β”‚   β”‚   β”‚   └── login.blade.php      # Login page
β”‚   β”‚   β”œβ”€β”€ dashboard.blade.php      # Dashboard page
β”‚   β”‚   └── welcome.blade.php        # Welcome page
β”‚   β”œβ”€β”€ css/
β”‚   β”‚   └── app.css                  # Main CSS file
β”‚   └── js/
β”‚       β”œβ”€β”€ app.js                   # Main JavaScript file
β”‚       └── bootstrap.js             # JavaScript bootstrap
└── routes/
    └── web.php                      # Web routes

Technology Stack

  • Backend: Laravel 10, Laravel Sanctum
  • Frontend: Blade Templates, Tailwind CSS, Alpine.js
  • Authentication: Usersau OAuth 2.0
  • Build Tools: Vite

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is open-sourced software licensed under the MIT license.

Support

For support, please contact opensource@users.au or create an issue in the repository.

About

A Laravel starter kit with Usersau OAuth integration, built with traditional Blade templates and Tailwind CSS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published