[HN Gopher] Show HN: Val Town - A Cloud Scripting Site
___________________________________________________________________
 
Show HN: Val Town - A Cloud Scripting Site
 
Hey HN! We're so excited to show you Val Town (https://val.town)! A
"val" is a JavaScript/TypeScript function or value that runs on our
servers. We aim to get you from idea to running code in seconds:
type code, run it, get its API endpoint, schedule it - all from the
browser, in a couple keystrokes.  We're a startup of 4 people,
mostly in NYC. We've been working on this for 6 months and are
eager for feedback from the HN community.  Why do we need yet
another online coding IDE? While researching devtools[1], I found
myself wanting something halfway between Replit and Zapier: a tool
that makes hosting, deploying, scheduling, and authenticating easy,
but is first-and-foremost a programming tool.  We added
`console.email` to the runtime to make it incredibly easy to email
yourself. We don't have npm imports yet, but we do have a low-
friction system that treats every user as a namespace, so you can
refer to `@me.foo + 1` or `@yourFriend.bar()` right in your code.
There are a lot of thorny implications this newfangled import
scheme creates, but also many joyous and carefree coding
experiences! One of my favorite features is that we store every
evaluation, up and down the callstack, including inputs, outputs,
logs, etc, which has been an amazing aid to debugging.  So far, Val
Town is mostly used for what we're calling "programmatic
notifications": query a data source for new items on an interval
and email them to yourself.  Get notified when users you "follow"
post on Hacker News:
https://www.val.town/stevekrouse.hnFollowPollJob  Get notified when
to close your window during fire season in SF:
https://www.val.town/stevekrouse.aqi  Get notified when there are
new citations on a paper:
https://www.val.town/ernest.newCitationNotification  Subscribe to
RSS feeds: https://www.val.town/stevekrouse.pollRSSFeeds  A good
place to get started would be forking one of those vals and
modifying it to suit your needs. Some folks are using the tool in
other ways, such as in webhook contexts, and we encourage those
uses as well. We'd LOVE to pair-program with anyone looking to try
out the tool and give feedback. Email steve@val.town :-)  Main
site: https://val.town Docs: https://val-town.notion.site/Val-Town-
Docs-01c8eb9c534b48998... Discord: https://discord.gg/dHv45uN5RY
Blog & Newsletter: https://val-
town.notion.site/Blog-6d3ef714d0c849e9be71b3986a...  [1] - Whole
Code Catalog: https://futureofcoding.org/catalog/
 
Author : stevekrouse
Score  : 138 points
Date   : 2023-01-11 19:18 UTC (3 hours ago)
 
web link (www.val.town)
w3m dump (www.val.town)
 
| teruakohatu wrote:
| Looks nice. Is there any persistant key/value store?
| 
| I like your https://www.val.town/ernest.newCitationNotification
| but it works because the JSON returned by the API call happens to
| include a list of citations by date, rather than just returning a
| citation count.
| 
| If you had an API that just returned a count, how would I check
| to see if the count had increased since the last call?
| 
| For the air quality example,
| https://www.val.town/stevekrouse.aqi, what prevents the script
| from emailing you once per hour? During a file season that would
| be annoying.
 
  | stevekrouse wrote:
  | Great questions! The short answer is yes: the val namespace can
  | act as a persistent key/value store. Type write
  | `@me.citationCount = 7` anywhere in your code, and that will
  | work. The downside is that this is a global store of state, so
  | it's harder to build composable functions that have persistent
  | state. We're working on designs for this!
  | 
  | You are totally right about the fire season script getting
  | annoying. We should probably also have some mutable state there
  | so that it only notifies you once when it goes above the
  | threshold and then once when it's back safe again.
 
| jalino23 wrote:
| this seems super cool! how is this free?
 
  | stevekrouse wrote:
  | Thanks! The short answer is that we're super small and folks
  | are using us for really light use-cases. Our total server costs
  | are less than $100 / month.
  | 
  | Eventually, we'll offer paid services for folks that want more
  | processing power or other goodies, but we will always provide a
  | generous free tier.
 
    | lovasoa wrote:
    | 100$/month for a site that runs random people's code seems
    | great ! Do you mind sharing some details ? What does your
    | architecture look like ? How many "vals" do you have, and how
    | many executions per day ?
 
      | stevekrouse wrote:
      | We've got one node of 2 vCPU & 8192 MB on Northflank for
      | $72 / month. We were getting away with 1 vCPU & 2048 MB,
      | but increased it yesterday to be extra safe for this
      | launch.
      | 
      | Our database on Supabase is $75 / month, and it's also way
      | overkill but the dollars are small and we'd rather be safe.
      | 
      | So yesterday we were just under $100 / month, but today
      | we're closer to $150.
 
        | noduerme wrote:
        | This is really interesting, but... if you don't mind me
        | asking, how do you prevent people from running malicious
        | code on your server? Are you literally _evaluating_ this
        | code inside a Nodejs loop? It seems almost impossible to
        | secure something like that.
 
        | stevekrouse wrote:
        | I don't want to say too much, because I know our security
        | isn't perfect, and some about of obfuscation adds some
        | security. Once we move to a more secure model, I will
        | happily tell you all what use _used_ to use to sandbox
        | code.
        | 
        | Soon we'll do real sandboxing, either ourselves through
        | Docker, wasm, bubblewrap[1], etc, or an existing FaaS
        | (Lambda, Deno Deploy, Cloudflare Workers) or FaaSaaS
        | (Deno Subhosting)
        | 
        | [1] - https://github.com/containers/bubblewrap
 
        | kentonv wrote:
        | FWIW Cloudflare offers Workers for Platforms, which I
        | literally called "FaaSaaS" in my early design docs but
        | for some reason that name didn't stick... :)
        | 
        | https://developers.cloudflare.com/cloudflare-for-
        | platforms/w...
 
| aliqot wrote:
| This right here is going to be big. Good job Steve and co :)
 
| elbajo wrote:
| Big fan of the idea!
| 
| I've been using Google Apps Script[1] for similar use cases but
| the limited feature set has been frustrating. Glad to see
| something more modern come up!
| 
| I wonder if HTML parsing is possible since there isn't npm
| support to import a parser yet. Maybe by dropping the parser as a
| separate val?
| 
| [1] - https://www.google.com/script/start/
 
  | stevekrouse wrote:
  | Thanks! We manually added `parseXML` to our runtime, which uses
  | fast-xml-parser from npm. Would that work for your usecase? I'm
  | happy to manually add other npm modules by request until we
  | figure out a longer-term solution. Your other idea of adding
  | them as a val also works.
 
| HiroProtagonist wrote:
| Very cool idea!
 
| jackbridger wrote:
| Really cool concept, really enjoyed playing with this a few
| months ago and great to see so much progress - especially emails.
| I do think it will lower the bar for what's worth writing code
| for
 
| awbraunstein wrote:
| This is so awesome. Congrats Steve and team on this launch!
| 
| I'm excited to see what people build here.
 
| warent wrote:
| Seems very cool!
| 
| I gotta say hosting someone else's code seems very ballsy.
| Building a service like this is something I've considered before
| but always wonder, how do you make sure they're not doing
| unscrupulous activities?
 
  | stevekrouse wrote:
  | Thanks!!
  | 
  | Excellent question. We're using a node sandboxing environment
  | that nobody has been able to break out of yet, but we plan to
  | move to a more secure isolation model very soon.
  | 
  | We're still small enough that we can keep decent tabs on what
  | folks are doing with the platform, but it's only a matter of
  | time before the DDOSers and crypto miners come looking for
  | trouble...
 
| triyambakam wrote:
| It seems similar to Deno Deploy, is that true? If so, how does it
| compare?
 
  | stevekrouse wrote:
  | Yes, it is similar! We see Deno Deploy more as a competitor to
  | AWS Lambda or Cloudflare workers, a true business-scale
  | offering.
  | 
  | Val Town is more light, fun and social. It's meant to be used
  | in personal and casual use-cases -- at least for now. We want
  | to give off more GitHub vibes; less AWS vibes.
 
| TylerJewell wrote:
| This is a phenomenal mixture of abstraction, design, and state
| management to peel away infrastructure complexity.
 
| catapart wrote:
| This is pretty neat!
| 
| I went ahead and dropped in a string tokenizer that I've been
| working on, and it worked straight away! (link:
| https://www.val.town/embed/catapart.magnitTokenize) I'm sure I'm
| doing it inefficiently, but it's pretty sweet that it just plain
| worked!
| 
| Thanks for building such an open platform! I know I can get some
| real value of utilities like this, so it's nice to know that
| there are folks out there willing to provide them! Hopefully any
| code I can add can be of use to someone!
| 
| edited to add: I also included a test of the tokenizer, if anyone
| was wanting to tokenize some strings with it:
| https://www.val.town/embed/catapart.testTokenizer
 
| Alifatisk wrote:
| This is unique and exciting!
 
| JZL003 wrote:
| Oooh I think this is great
| 
| Another one, as an example, check the FDA food and drug alerts
| for medicine you take. I guess the pharmacy should email you but
| who knows, it's just filtering an xml for a set of regex. I built
| a cheap example myself on a micro self hosted server I use for
| other things
| 
| Having quick and easy email behind a very simple url is great.
| Another usecase I use is I have a tiny http endpoint which just
| emails based on the url parameter (e.g. since it's only me
| my.server.com/email?msg=DONE_AI_training). Then I can use it to
| notify me when a long running job is done, using curl or the easy
| off the shelf requests that's in any language
 
  | JZL003 wrote:
  | I think I'll start using it but I'd like self hosting only
  | because I want to set it and forget it for years potentially,
  | and I don't want to have to check to make sure it's still
  | working
 
    | paxys wrote:
    | I don't really see the utility of a tool like this + self
    | hosting. If you want to self host your scripts just...open a
    | text editor and start writing.
 
| esilverman wrote:
| Congrats Steve! Keeping an eye on this
 
| dustingetz wrote:
| Quick start -
| 
| click "new val"
| 
| type `console.email("hello from valtown", "valtown");` , see
| email in about 10 seconds, and the val link has a log of emails
| sent
| 
| new val, `export hackerNewsAuthors = ["stevekrouse",
| "dustingetz"];`
| 
| go here, click fork
| https://www.val.town/stevekrouse.hnFollowPollJob
| 
| run
| 
| i think the hook is running now, wait for steve to post again to
| see?
| 
| if someone is feeling motivated, maybe integrate a weather API
| and mail it every morning?
 
| DavyJone wrote:
| This looks really cool, I find the mix between Zapier and Code to
| be :chef-kiss:
| 
| Do you plan to allow for self-hosting? eg. An org that wants to
| have a private version of this, or even internal version of it.
 
  | stevekrouse wrote:
  | Thanks! I would love to do self-hosting, but probably not any
  | time soon. We're currently focused on making a delightful
  | hobbyist product, and punting on all the business features for
  | a while. We do hope to get there though!
 
| schappim wrote:
| I like this. It's like a modern version of webscript.io . The
| ability to provide form input / render HTML would be awesome.
 
  | stevekrouse wrote:
  | Yes! I was a huge fan of webscript.io. Great feature request,
  | too.
 
| akkartik wrote:
| I want to draw particular attention to the use case of following
| HN users. I've been using it for a couple of months, and been
| finding a lot more great comments here as a result. There's a
| separate front-end that's the best way to get started following
| people: https://www.hnfollow.com. And if you find yourself
| wishing it worked slightly differently for you, well you can go
| edit the underlying Val then.
| 
| Hit me up if you would like help setting this up for yourself and
| don't want to join the Discord or something. My email is in my
| profile. You basically need to create a new Val for yourself
| called `hackerNewsAuthors` that's just an array of HN username
| strings.
 
  | stevekrouse wrote:
  | The backstory here is that when we saw how akkartik was using
  | the tool, we decided to double down on this particular usecase
  | and we built hnfollow.com as a showcase of what could be done
  | with the tool, but holding your hand every step of the way.
  | 
  | We even posted it to HN but dang rightly rerouted us to this
  | proper Show HN: https://news.ycombinator.com/item?id=33533830
  | 
  | In the meantime, we launched "Scheduled Val" which let you
  | schedule a val with a single click, and it somewhat made
  | hnfollow.com unnecessary because most of that tool helped you
  | manage setting up an interval, tracking its ID, and cancelling
  | it. Now you can just fork this single val to your account and
  | the interval is synced to the val automatically:
  | https://www.val.town/stevekrouse.hnFollowPollJob
  | 
  | The one extra step that akkartik alludes to is also important:
  | you do need to define some folks to follow. How to handle-hold
  | users through this process of forking + customizing vals is a
  | real design challenge for us. Would love any suggestions!
 
| paxys wrote:
| I love the concept and will definitely try this out. Quick piece
| of feedback though - the "val.town" domain name isn't going to
| help with broader appeal for the product.
 
| vanjajaja1 wrote:
| I really like this idea, some sort of mashup of simple cloud
| function website and social network. looks fun, time to build a
| game :)
 
| RobotToaster wrote:
| Is it open source?
 
  | stevekrouse wrote:
  | We hope to make parts of it open-source! Just hasn't been a
  | focus yet
 
| bnzr wrote:
| this is extremely cool -- feels like a ton of new use cases will
| unfold as people explore it. congrats on the launch!
 
| ninjaa wrote:
| This is super awesome. A cloud cron builder and workflow builder
| is something the world really needs. If you add secrets and user
| accounts you're off to the races here.
 
| brap wrote:
| I love the import/export model, it feels like one big living
| codebase everyone can contribute too.
 
___________________________________________________________________
(page generated 2023-01-11 23:00 UTC)