Skip to content

Commit

Permalink
docs: updated docs for perseus new and co
Browse files Browse the repository at this point in the history
  • Loading branch information
arctic-hen7 committed Jul 14, 2022
1 parent 618006c commit 8810c23
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<h1 align="center">Perseus</h1>

[![Book](https://img.shields.io/badge/Book-arctic--hen7.github.io-informational?style=for-the-badge)](https://arctic-hen7.github.io/perseus)
[![Book](https://img.shields.io/badge/Book-arctic--hen7.github.io-informational?style=for-the-badge)](https://arctic-hen7.github.io/perseus/en-US/docs)
[![API Docs](https://img.shields.io/docsrs/perseus?label=API%20Docs&style=for-the-badge)](https://docs.rs/perseus)
[![Crate Page](https://img.shields.io/crates/v/perseus?style=for-the-badge)](https://crates.io/crates/perseus)
[![Top Language](https://img.shields.io/github/languages/top/arctic-hen7/perseus?style=for-the-badge)]()
Expand All @@ -18,7 +18,7 @@ Perseus is a blazingly fast frontend web development framework built in Rust wit
- 🏎 Lighthouse scores of 100 on desktop and over 95 on mobile
- ⚡ Support for *hot state reloading* (reload your entire app's state after you make any code changes in development, Perseus is the only framework in the world that can do this, to our knowledge)

## Usage
## What's it like?

Here's a taste of Perseus (see [the _tiny_ example](https://github.com/arctic-hen7/perseus/tree/main/examples/comprehensive/tiny) for more):

Expand All @@ -40,13 +40,28 @@ pub fn main<G: Html>() -> PerseusApp<G> {

Check out [the book](https://arctic-hen7.github.io/perseus/en-US/docs) to learn how to turn that into your next app!

## Quick start

If you want to start working with Perseus right away, run the following commands and you'll have a basic app ready in no time! (Or, more accurately, after Cargo compiles everything...)

``` shell
cargo install perseus-cli --version 0.4.0-beta.3
perseus new my-app
cd my-app/
perseus serve -w
```

Then, hop over to <http://localhost:8080> and see a placeholder app, in all its glory! If you change some code, that'll automatically update, reloading the browser all by itself. (This rebuilding might take a while though, see [here](https://arctic-hen7.github.io/perseus/en-US/docs/next/reference/compilation-times) for how to speed things up.)

Check out our [getting started tutorial](https://arctic-hen7.github.io/perseus/en-US/docs/next/getting-started/installation) for more, or head over to out [core principles](https://arctic-hen7.github.io/perseus/en-US/docs/next/core-principles) page, which explains the basics of how Perseus works. Enjoy!

## Aim

Support every major rendering strategy and provide developers the ability to efficiently create super-fast apps with Rust and a fantastic developer experience!

## Motivation

There is a sore lack of Rust frameworks for frontend development that support more than just SPAs and client-side rendering, and so Perseus was born. We need something like NextJS for Wasm (but why stop there?).
There is a sore lack of Rust frameworks for frontend development that support more than just SPAs and client-side rendering, and so Perseus was born. We need something like NextJS for Wasm. From there, we started getting interested in a more state-drive approach to web development, and here we are!

## Contributing

Expand Down
4 changes: 3 additions & 1 deletion docs/next/en-US/getting-started/first-app.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Your First App

With a basic directory scaffold all set up, it's time to get into the nitty-gritty of building a Perseus app. Somewhat humorously, the hardest part to wrap your head around as a beginner is probably going to be the `Cargo.toml` we're about to set up. For now, make it look like the following.
With a basic app scaffold all set up, it's time to get into the nitty-gritty of building a Perseus app. Somewhat humorously, the hardest part to wrap your head around as a beginner is probably going to be the `Cargo.toml` we're about to set up. It should look something like the following.

```toml
{{#include ../../../examples/comprehensive/tiny/Cargo.toml.example}}
Expand Down Expand Up @@ -82,3 +82,5 @@ Now, try updating that `Hello World!` message to be a little more like the first
Now stop that command with `Ctrl+C` and run `perseus deploy` instead. This will take a very long time, but it will produce a `pkg/` directory that you could put on a real-world server, and it would be completely ready to serve your brand-new app! Because this app is so simple, you could even use `perseus deploy -e` instead to just produce a bunch of flat files that you could host from anywhere without needing a proper server.

All this has just scratched the surface of what's possible with Perseus, and there's so much more to learn! The next big things are about understanding some of the core principles behind Perseus, which should help you to understand why any of what you just did actually worked.

*Note: next time you make a Perseus app, you can speed up the boilerplate with `perseus new`, which sets up everything you need straight away!*
21 changes: 4 additions & 17 deletions docs/next/en-US/getting-started/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,26 +18,13 @@ cargo install perseus-cli

This will take a few minutes to download and compile everything. (Note: if you don't have Rust or Cargo yet, see [here](https://rust-lang.org/tools/install) for installation instructions.)

Next up, you should create a new directory for your app and set it up like so:
Next up, you should set up your new app like so:

```sh
cargo new --lib my-app
perseus new my-app
cd my-app
```

This will create a new directory called `my-app/` in your current directory, set it up for a new Rust project, and then move into that directory. If you want to move this directory somewhere else, you can do that as usual, everything's self-contained.
This will create a new directory called `my-app/` in your current directory, setting it up for a new Perseus project. If you want to move this directory somewhere else, you can do that as usual, everything's self-contained.

You'll notice in there a file called `Cargo.toml`, which is the manifest of any Rust app; it defines dependencies, the package name, the author, etc.

In that file, add the following underneath the `[dependencies]` line:

```
perseus = { version = "=0.4.0-beta.3", features = [ "hydrate" ] }
sycamore = "=0.8.0-beta.7"
```

*Note: we install Sycamore as well because that's how you write views in Perseus, it's useless without it! We've also used the `=[version]` syntax here to pin our app to a specific beta version of Sycamore, otherwise Cargo will politely update it automatically when a new version comes out. Normally, that's very nice of it, but, when we're working with beta versions (which won't be for much longer, hopefully!), a new version could break your code, so it's best to deliberately update when you decide to.*

Now you can run `cargo build`, and that will fetch the `perseus` crate and get everything ready for you! Note that we haven't defined the integration as a dependency yet, and that's deliberate, because this `Cargo.toml` is going to get *much* more complicated!

But, for now, you're all good to move onto the next section, in which we'll build our first app with Perseus!
You can run `perseus serve -w` now if you want to see the placeholder app, or you can move ahead to the next section to get your feet wet.

0 comments on commit 8810c23

Please sign in to comment.