Dashboard Hero
  • Scope
  • Introduction
    • Meet and greet
    • Requirements(tech)
    • Requirements(user)
  • Setting up
    • Developing locally
    • Deploying
  • Basics
    • Scss
    • Javascript
    • Svelte framework
    • vs React vs Angular vs vue.js
    • Rollup(and rollup.config.js)
    • NPM(and package.json)
  • Project structure
    • Overview
    • Git version
    • Folder version
  • Architecture
    • DRY vs WET programming
    • Basic
    • Extended
  • Components
    • Component lifecycle
    • Passing data between components
    • Buttons
    • Charts
    • Grids
    • Search bars
    • Other inputs
    • Dialogs
    • Dropdowns
    • Gauges
    • User management pages
  • Backend
    • Firebase cloud functions
  • Data sources
    • Firebase
    • MongoDB
    • *SQL sources
    • GraphQL
  • User management
    • Log in
    • Register
    • Forgot pass
    • Custom flows
    • Others
  • State control
    • Redux
    • MobX
    • Saga
  • Dashboard: a full project
    • Overview
    • Layout
    • Routing
    • Removing/adding pages
    • Deploying
  • Roadmap/tutorial
    • Introduction - building your own app
    • 1. UI - HTML&CSS
    • 2. Data sources(+testing)
    • 3. Defining and using existing components
    • 4. User management
    • 5. Go live!
  • Troubleshooting
    • Can't run the project
Powered by GitBook
On this page

Was this helpful?

  1. Architecture

Basic

Here's how your admin dashboard works, in plain english.

Client

The most basic building blocks you will work with are the Svelte components. These are simply files that resemble an all too familiar HTML file: they have a script, a css style and an html part, that also happens to have a template system in place. The menu and the top bar are examples of such components. You can include components inside other components - for instance, the Menu component includes button components.

If you were to implement your dashboard using vanilla html, you would have to write on every single page the code for your menu - this is prone to errors and boring. Instead, on each page that needs to have a menu, you will include the Svelte component, and simply type <Menu /> in order to display it. You can rest assured that each time you modify something in the Menu component, it will change on all your internal admin pages.

The entry point for the app is the App.svelte file. Here, we decide what to show the user if it's authenticated or not, and instantiate the Router. The Router knows how to draw different Components based on the url the user has typed in.

How do we avoid importing the Menu and TopBar component in each page component? We have a component named AdminLayout, where we instantiate the Menu and TopBar components. Then, we tell the router that we have a parent component, and a set of nested routes. The nested routes will be the inner pages of our admin dashboard.

The firebase client exposes functions that help us deal with authentication: log in, register users, reset password. Firebase also helps us work with files and call cloud functions(our server-side or backend system).

All of the above can be found in the src folder.

Server

The only server component your admin dashboard needs are the cloud functions, which can be found in the functions folder.

PreviousDRY vs WET programmingNextExtended

Last updated 5 years ago

Was this helpful?