Coder Social home page Coder Social logo

nikoheikkila / photo-browser Goto Github PK

View Code? Open in Web Editor NEW
77.0 6.0 2.0 1.7 MB

A modern frontend application architecture built with SvelteKit and Hexagonal / Clean Architecture principles

Home Page: https://nikoheikkila.fi/blog/clean-frontend-architecture-with-sveltekit

License: MIT License

JavaScript 2.91% TypeScript 79.66% HTML 1.11% Svelte 16.32%
clean-architecture dracula hexagonal-architecture playwright svelte sveltekit typescript vite vitest zod

photo-browser's Introduction

๐ŸŒ… SvelteKit Photo Browser ๐ŸŒ‰

A website for browsing photos and albums delivered via Typicode API.

The real purpose of this project is to demonstrate building a modern frontend application architecture with SvelteKit and Hexagonal / Clean Architecture principles.

Clean Frontend Architecture with SvelteKit

Read the guide in my blog where I'm building the application and explaining the design process behind it.

Demo

See the demo application on Netlify.

Instructions

  1. Install Task
  2. Install project dependencies with task install
  3. Run application development mode with task dev
  4. Make changes
  5. Run tests with task test

Architecture

Overview of the software architecture and design is visualised in a Mermaid diagram below.

classDiagram
    direction

    class SvelteKit {
        <<Framework>>
    }

    class Layout {
        load(LayoutParams params) LayoutData
    }

    class Page {
        ssr : boolean
        csr : boolean
        load(RouteParams params) PageData
    }

    class Component
    class Script
    class HTML
    class Style

    class PhotoBrowser {
        <<Service>>
        withLimit(int limit) self
        loadPhotos() Array~Photo~
        loadPhoto(int id) Photo
        loadFromAlbum(int albumId) Array~Photo~
        groupPhotosByAlbum() Array~Album~
    }

    class PhotoCalculator {
        <<Service>>
        parseFullSize() Tuple~int~
        parseThumbnailSize() Tuple~int~
    }

    class Photo {
        <<Entity>>
        id : int
        albumId : int
        title : string
        url : URL
        thumbnailUrl : URL
    }

    class PhotoGateway~T~ {
        <<interface>>
        fetchPhotos(FetchParams args) Array~T~
	    fetchPhoto(int id) T
	    fetchPhotosByAlbumId(int albumId, FetchParams params) Dictionary~T~
    }

    class APIGateway~T~ {
        <<Adapter>>
    }

    class Typicode {
        <<REST API>>
    }

    class Vitest {
        <<Test Framework>>
    }

    class FakeGateway~T~ {
        <<Test Double>>
    }

    class FakerJS {
        <<library>>
    }

    SvelteKit "1" --> "1" PhotoBrowser : uses
    SvelteKit "1" --> "1" PhotoCalculator : uses
    SvelteKit "1" --> "1" Layout : loads
    Layout "1" --> "*" Page : contains
    Page "1" --o "*" Component : renders
    Component "1" --> "1" Script : contains
    Component "1" --> "1" HTML : contains
    Component "1" --> "1" Style : contains

    PhotoBrowser --> APIGateway : uses
    Vitest --> FakeGateway : uses
    PhotoGateway "1" --> "*" Photo : fetches

    APIGateway --|> PhotoGateway : implements
    APIGateway ..> Typicode : uses
    FakeGateway --|> PhotoGateway : implements
    FakeGateway ..> FakerJS : uses

photo-browser's People

Contributors

dependabot[bot] avatar ortiz-antonio avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

photo-browser's Issues

What's Dictionary

Can you please give me insights about what is the Dictionary you're using mainly inside your domain folder. Thanks beforehand

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.